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:

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)

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