Hi! I recently made a script that controls lighting on a stage, however for some reason when I join the game, it turns on all the actions in the script, even though it was never requested to be turned on. If you’re unsure what I mean, the code below should give you some more information. If you’re still confused, i will be watching this topic for any questions you may have~!
local DJLightCoro = coroutine.create(function()
while wait(0.1) do
for _,Panel in pairs(game.Workspace.WaterparkDestination.Stage:WaitForChild("DJLights"):GetChildren()) do
Panel.LED.Color.BackgroundColor3 = Color3.fromRGB(255,0,0)
wait(0.2)
Panel.LED.Color.BackgroundColor3 = Color3.fromRGB(0,255,0)
wait(0.2)
Panel.LED.Color.BackgroundColor3 = Color3.fromRGB(0,0,255)
wait(0.2)
Panel.LED.Color.BackgroundColor3 = Color3.fromRGB(0,255,0)
wait(0.1)
end
end
end)
local BackLightCoro = coroutine.create(function()
while wait(0.1) do
for _,Panel in pairs(game.Workspace.WaterparkDestination.Stage:WaitForChild("BackWallLights"):GetChildren()) do
Panel.LED.Color.BackgroundColor3 = Color3.fromRGB(255,0,0)
wait(0.2)
Panel.LED.Color.BackgroundColor3 = Color3.fromRGB(0,255,0)
wait(0.2)
Panel.LED.Color.BackgroundColor3 = Color3.fromRGB(0,0,255)
wait(0.2)
Panel.LED.Color.BackgroundColor3 = Color3.fromRGB(0,255,0)
wait(0.1)
end
end
end)
game.ReplicatedStorage.StageLights.OnServerEvent:Connect(function(plr, Action)
if Action == "DJLightsOn" then
coroutine.resume(DJLightCoro)
elseif Action == "BackLightsOn" then
coroutine.resume(BackLightCoro)
elseif Action == "ConfettiOn" then
for _,Confetti in pairs(game.Workspace.WaterparkDestination.Stage.Confetti:GetChildren()) do
for _,Particle in pairs(Confetti:GetChildren()) do
if Particle:IsA("ParticleEmitter") then
Particle.Enabled = true
end
end
end
elseif Action == "BubblesOn" then
for _,Bubble in pairs(game.Workspace.WaterparkDestination.Stage.Bubbles:GetChildren()) do
Bubble.Stick.ParticleEmitter.Enabled = true
end
elseif Action == "FireOn" then
for _,Fire in pairs(game.Workspace.WaterparkDestination.Stage.Fire:GetChildren()) do
Fire.ParticleEmitter.Enabled = true
end
elseif Action == "FStageLightsOn" then
for _,Light in pairs(game.Workspace.WaterparkDestination.Stage.FrontStageLights:GetChildren()) do
for _,Lights in pairs(Light.Head.Lights:GetChildren()) do
Lights.SurfaceLight.Color = game.Workspace.WaterparkDestination.Stage.DJLights.Panel.LED.Color.BackgroundColor3
Lights.Color = game.Workspace.WaterparkDestination.Stage.DJLights.Panel.LED.Color.BackgroundColor3
end
end
else
return
end
end)