So I have a button with a serverscript that fires an event to the client. The desired output is some flashing lights and a sound. Although the sound does play and stop when the alarmon variable is off and on respectively, the lights do not flicker. Any feedback would be appreciated.
(This is inside a local script):
local event = game.ReplicatedStorage.SystemEvents:WaitForChild("Evacuation")
local sound = workspace.SystemSounds:WaitForChild("Evacuation")
local alarmon = false
local debounce = false
function Evacuate()
if not debounce then
debounce = true
if alarmon == false then
alarmon = true
sound.Looped = true
sound:Play()
while alarmon do
for i, child in pairs(workspace:GetChildren()) do
if child.Name == "RedBeacon" then
child.Light.PointLight.Brightness = 1
wait(1)
child.Light.PointLight.Brightness = 0
wait(1)
if alarmon == false then
print("turnoff")
break
end
end
end
wait(1)
debounce = false
end
else
for i, child in pairs(workspace:GetChildren()) do
if child.Name == "RedBeacon" then
child.Light.PointLight.Brightness = 0
sound.Looped = false
sound:Stop()
wait(1)
alarmon = false
debounce = false
end
end
end
end
end
event.OnClientEvent:Connect(Evacuate)
Local scripts can only change things for the client, maybe you can try changing the lights from the server script. And have you done :FireAllClients()? Do all of the players hear the sound?
Well the lights can be changed from a localscript, that’s not the issue. It’s something in my formatting. (I am purposefully changing the lights from the client).
Is there anything in the output? I tested and it works for me, is there a folder/model called Light inside the part? Because you wrote child.Light.PointLight.
I made a simple script that fires the event to all clients, and I removed that Light from Light.PointLight and it worked fine, I saw it flickering
I have just put a PointLight inside the part.
Great! But I don’t fully understand how it fixed it, Have you spelled it wrong? It worked for me without the variable. Maybe it’s because you have changed it from Light to light? I can confirm that your script worked for me without the variable and I can send a video of it
I’m not gonna lie I’m not quite sure… it’s something I noticed early on when I started scripting, at times you can’t really change a variable if it is like the child of a child of a child or something…
It works for me with your normal script, look at this video I made, I connected te script with a touch event, and when you touch it, it fires the event, and it works perfectly, the light is flickering and you can hear the quiet alarm.