I have been trying to change the can collide and transparency of a part, while also changing the audio. It works perfectly in Roblox studio but in the game, it doesn't.
local debounce = false
game.Workspace.LazerDisable.DisableLazerEvent.OnServerEvent:Connect(function()
wait(0.1)
if not debounce then
debounce = true
game.Workspace.Lockdown.CanCollide = true
game.Workspace.Lockdown.Transparency = 0.9
wait(0.25)
game.Workspace.Lockdown.Transparency = 0.8
wait(0.25)
game.Workspace.Lockdown.Transparency = 0.7
wait(0.25)
game.Workspace.Lockdown.Transparency = 0.6
wait(0.25)
game.Workspace.Lockdown.Transparency = 0.5
wait(0.25)
game.Workspace.Lockdown.Transparency = 0.4
wait(0.25)
game.Workspace.Lockdown.Transparency = 0.3
wait(0.25)
game.Workspace.Lockdown.Transparency = 0.2
wait(0.25)
game.Workspace.Lockdown.Transparency = 0.1
wait(0.25)
game.Workspace.Lockdown.Transparency = 0
game.Workspace.Song.Volume = 0
local s = Instance.new("Sound")
-- alarm sound
s.Name = "alarmSound"
s.SoundId = "http://www.roblox.com/asset/?id=293499018" -- Type your music ID here
s.Volume = 1
s.Pitch = 1
s.Looped = true
s.archivable = false
s.Parent = game.Workspace
wait(0)
s:play()
-- lockdown sound
local s = Instance.new("Sound")
s.Name = "lockdownSound"
s.SoundId = "http://www.roblox.com/asset/?id=1836476447" -- Type your music ID here
s.Volume = 1
s.Pitch = 1
s.Looped = false
s.archivable = false
s.Parent = game.Workspace
wait(15)
s:play()
wait(15)
s:play()
wait(15)
s:play()
wait(15)
debounce = false
end
end)

4 comments
why use events while you can just put a normal script and put it in workspace or server script service?
because I need it to show for everyone on the server not just 1 person
and because it is activated by a click detector
Thats a reason for it