Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix this sound script?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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.

http://prntscr.com/bc1kxk

This is the code:

01local active = false
02 
03function click()
04    if active == false then
05        sound = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
06        sound.SoundId = "http://www.roblox.com/asset/?id=147605033"
07        sound.Volume = 1
08        sound.Looped = true
09        sound:Play()
10        script.Parent.Selected = true
11        active = true
12    elseif active == true then
13        sound:Destroy()
14        script.Parent.Selected = false
15        active = false
16    end
17end
18 
19script.Parent.MouseButton1Down:connect(click)
0
I this a LocalScript? theCJarmy7 1293 — 8y
0
Its a regular script. alexduskthorn 40 — 8y
0
Also more info, it's supposed to play a sound for the player and anyone else around the player. alexduskthorn 40 — 8y
0
You can't do game.Players.LocalPlayer in a regular script, only in localscripts thehybrid576 294 — 8y
View all comments (7 more)
0
Yeah it has to be a LocalScript User#9949 0 — 8y
0
I've been told if its a local script, then the other players wont be able to hear the audio, only you? alexduskthorn 40 — 8y
0
If FE is on, then yes. Just use a remote event if you want all the players to hear it theCJarmy7 1293 — 8y
0
What would that code look like with the remove event then? alexduskthorn 40 — 8y
0
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 dragonkeeper467 453 — 8y
0
<http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial> dragonkeeper467 453 — 8y
0
Still looking for help on what the code should be. Don't understand what to make it. alexduskthorn 40 — 8y

Answer this question