Hello devs! So I am working on round cycle for my game, and I use TweenService, but for some reason the tweens don’t play.
Code (in ServerScriptService) :
local ts = game:GetService("TweenService")
local night = ts:Create(game.Lighting,TweenInfo.new(30,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0),{
Ambient = Color3.fromRGB(90,90,90),
ClockTime = 0,
Brightness = 0.5,
FogColor = Color3.fromRGB(0,0,0)
})
local day = ts:Create(game.Lighting,TweenInfo.new(15,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0),{
Ambient = Color3.fromRGB(180,180,180),
ClockTime = 10,
Brightness = 2,
FogColor = Color3.fromRGB(180,180,180)
})
local debugMode = false
game.Lighting.Ambient = Color3.fromRGB(180,180,180)
game.Lighting.ClockTime = 10
game.Lighting.FogEnd = 110
local Time = game.ReplicatedStorage.Time
local function round()
if workspace:FindFirstChild("Rake") then
workspace.Rake.Parent = game.ReplicatedStorage
end
workspace.Day.Value = true
Time.Minutes.Value = 0
Time.Seconds.Value = 30
repeat task.wait(1)
if Time.Seconds.Value <= 0 then
Time.Minutes.Value -= 1
Time.Seconds.Value = 59
else
Time.Seconds.Value -= 1
end
until Time.Seconds.Value <= 0.1 and Time.Minutes.Value <= 0.1
night:Play()
night.Completed:Wait()
workspace.Day.Value = false
local rake = game.ReplicatedStorage.Rake:Clone()
rake.Parent = workspace
rake:SetPrimaryPartCFrame(workspace.CaveEntrance.CFrame + Vector3.new(0,3,0))
Time.Minutes.Value = 1
Time.Seconds.Value = 30
repeat task.wait(1)
if Time.Seconds.Value <= 0 then
Time.Minutes.Value -= 1
Time.Seconds.Value = 59
else
Time.Seconds.Value -= 1
end
until Time.Seconds.Value <= 0.1 and Time.Minutes.Value <= 0.1
day:Play()
workspace.Day.Value = true
if rake then
repeat task.wait() until (workspace.CaveEntrance.Position - rake.HumanoidRootPart.Position).Magnitude < 3
rake:Destroy()
rake = nil
return round()
else
return round()
end
end
round()