Hello, I was wondering how to fix this script. I get this error whenever it gets activated. Also more info, it's supposed to play a sound for the player and anyone else around the player.
This is the code:
local active = false
function click()
if active == false then
sound = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
sound.SoundId = "http://www.roblox.com/asset/?id=147605033"
sound.Volume = 1
sound.Looped = true
sound:Play()
script.Parent.Selected = true
active = true
elseif active == true then
sound:Destroy()
script.Parent.Selected = false
active = false
end
end
script.Parent.MouseButton1Down:connect(click)

11 comments
I this a LocalScript?
Its a regular script.
Also more info, it's supposed to play a sound for the player and anyone else around the player.
You can't do game.Players.LocalPlayer in a regular script, only in localscripts
Yeah it has to be a LocalScript
I've been told if its a local script, then the other players wont be able to hear the audio, only you?
If FE is on, then yes. Just use a remote event if you want all the players to hear it
What would that code look like with the remove event then?
its on the wiki, make take a bit of practice to understand... but its worth it in order to keep your place free from exploiters and hackers
http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial
Still looking for help on what the code should be. Don't understand what to make it.