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

How play a local sound on touched?

Asked by 8 years ago

Need help. I need music to player when a brick is touched, however only play locally (so that other players cannot hear it). I've kind of done it, however it works in "Test" mode, but not in an actual server. Any help is greatly appreciated.

UPDATE: Here are the scripts I have. And yes, I said scripts, as in plural, because I'm using multiple scripts to do something that probably only requires one script :P.

So, basically, I have music located inside of workspace. Theres a part, and when a player touches it, it fires this script:

function touched()
    game.Players.LocalPlayer.PlayerGui.moosic.Value = "run"
end
script.Parent.Touched:connect(touched)

"moosic" is a string value located inside of StartGui, which i need to access PlayerGui in order to change it in-game. The Value changes to "run", and another script inside StarterPack senses when its changed via this script:

wait(1)
m = game.Players.LocalPlayer.PlayerGui.moosic
print("ok")
m.Changed:connect(function()
    if m.Value == "run" then
        game.Workspace.moosic1:Play()
    end
end)

Like I said, it works in "test", but not in an actual server. I'm sure this is a lot more complex than it needs to be, so any help is appreciated.

1
can you give us the progress you have... HungryJaffer 1246 — 8y
1
This isn't a request site. Goulstem 8144 — 8y
0
*Echoes* This isn't a Reuqest site... GreekGodOfMLG 244 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Usually localscripts work..

Ad

Answer this question