local RS = game:GetService("ReplicatedStorage") local alert = RS:WaitForChild("alert1") local turnoff = RS:WaitForChild("turnoff1") local ison = game.Workspace.Post1.buttons.ALERT.Value.Value local sound = game.Workspace.Speaker.speaker.sound alert.OnServerEvent:Connect(function() sound.Playing = true ison = true end) if ison == true then print("ison = true") end turnoff.OnServerEvent:Connect(function() sound.Playing = false ison = false end)
What this is for is an alarm system. The "ison" value is boolean and is to check if the sound is on or not. In the Local Script, it detects if the ison value is true, and fires the correct event accordingly. Why doesn't it turn on though? The sound works, it plays fine, but the ison value never becomes true.
Try this:
local RS = game:GetService("ReplicatedStorage") local alert = RS:WaitForChild("alert1") local turnoff = RS:WaitForChild("turnoff1") local ison = game.Workspace.Post1.buttons.ALERT -- I'm not sure why you had 2 calls to the .Value property. local sound = game.Workspace.Speaker.speaker.sound alert.OnServerEvent:Connect(function() sound.Playing = true ison.Value = true end) if ison.Value == true then print("ison = true") end turnoff.OnServerEvent:Connect(function() sound.Playing = false ison.Value = false end)
Assuming that the object 'ison' is getting the value of is named 'ALERT', this should work.