So I want it to 3.5 okay, put the value +1 the value is 0 so if it went 5 times the value will be 5 so when the value hits 5 i want a code to play in the script not overlapping any of the tweens I want it to transparent when it hits 5 and then wait 20 seconds and fade back to 0 again, and set the value back to 0 and so on it’ll be smooth, will it lag the game if the value is like for example like 700 where it was played 700 times with the while wait +1, and played 700 so that’s 700 times it played, will it lag the game at all? And, also for example if I did it like this like uh when the value hit 50, right so I have certain ifs like if it hit 20 do the same thing if it hit 50 do the same thing and then set the value back to 0 and when its 5 again it’ll play the 5 if right, and so on to 50 and reset if this even makes any sense I’m putting too much thought into this honestly…?
Here’s the script:
local TweenService = game:GetService("TweenService")
local part = script.Parent
local tweenInfoColor = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
while wait(3.5) do
local randomColor = Color3.fromRGB( math.random(1, 255), math.random(1, 255), math.random(1, 255) )
part.Dance.Value = part.Dance.Value +1
--Dancefloor--
local tween = TweenService:Create(workspace.DanceFloor.DanceTile, tweenInfoColor, {Color = randomColor })
tween:Play()
--Everytime when the dancefloor changes color change the transparency to 0.25 back to 0 before it changes the color, don't make it overlap from when
--the aquarium shows stop it from transparenting then when aquarium fades back in, make it transparent to 0.25 tweened to 0 back again before it
--changes the color.
if part.Dance.Value == 5 then
game.Workspace.DanceFloor.DanceTile.Transparency = 0.1
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.1
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.2
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.2
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.3
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.3
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.4
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.4
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.5
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.5
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.6
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.6
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.7
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.7
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.8
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.8
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.9
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.9
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 1
game.Workspace.DanceFloor.Frames.Union.Transparency = 1
game.Workspace.DanceFloor.Base.Base.Transparency = 1
task.wait(20)
game.Workspace.DanceFloor.Base.Base.Transparency = 0
game.Workspace.DanceFloor.DanceTile.Transparency = 0.9
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.9
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.8
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.8
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.7
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.7
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.6
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.6
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.5
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.5
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.4
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.4
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.3
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.3
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.2
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.2
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0.1
game.Workspace.DanceFloor.Frames.Union.Transparency = 0.1
wait(0.1)
game.Workspace.DanceFloor.DanceTile.Transparency = 0
game.Workspace.DanceFloor.Frames.Union.Transparency = 0
part.Dance.Value = 0
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------- Lights ---------------------------------------------------------------------------------
for i, Part in pairs(workspace.DanceFloor.Lights2:GetDescendants()) do
local Ramp1Tween = TweenService:Create(Part, tweenInfoColor, {Color = randomColor })
Ramp1Tween:Play()
end
end