萝卜说 - 罗布乐思 - 口袋核心

查看: 855|回复: 1

[讨论] 简单易懂的【昼夜变化】,直接复制直接用

[复制链接]

0

收听

0

听众

38

帖子

正式用户

Rank: 1

萝卜币
65
发表于 2021-5-31 22:01:45 | 显示全部楼层 |阅读模式
脚本可用在LocalScript,也可以用在Script,区别就是:LocalScript是本地脚本,昼夜变化比较流畅,但是和其他玩家不会同步,Script是服务器脚本,有时候会因为延迟问题导致不流畅,但是会同步所有玩家的昼夜变化。
local lighit = game.Lighting
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
        300, -- Time
        Enum.EasingStyle.Linear, -- EasingStyle
        Enum.EasingDirection.In,
        0, -- RepeatCount (小于零时 tween 会无限循环)
        false, -- Reverses (tween 完成目标后会反转)
        0 -- DelayTime
)
local a = -3
local tween1 = TweenService:Create(lighit, tweenInfo, {ClockTime = 24,ExposureCompensation = 0})
local tween2 = TweenService:Create(lighit, tweenInfo, {ClockTime = 12,ExposureCompensation = 0})
tween1:Play()
tween1.Completed:Connect(function(playbackState)
        lighit.ClockTime = 0
        tween2:Play()
end)
tween2.Completed:Connect(function(playbackState)
        tween1:Play()
end)
回复

使用道具 举报

0

收听

0

听众

56

帖子

正式用户

Rank: 1

萝卜币
69
发表于 2021-5-31 22:01:51 | 显示全部楼层
看起来好厉害!!!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋| |京公网安备11010502045240号

Copyright © 2001-2013 Comsenz Inc.   All Rights Reserved.

Powered by Discuz! X3.4  备案:京ICP备2021013067号-2

快速回复 返回顶部 返回列表