Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can you please help me with a Sound script? (Un-Answered)

Now, I am stuck on something else... I put this following script for my Tycoon Sound:

game.Players[script.Parent.Owner.Value].PlayerGui.Sound2:Play()

The script's Parent has Owner(ObjectValue) in it, but when I go step on the button that activates the sound it says in-valid argument in the Output and I don't know why? Please help!

1 answer

✓ Accepted answer

In order to make audio only available to certain players at a time, you would have to place the sound object in the StarterGui or Backpack. When you use :Play() on that sound it will only play for the player whose Backpack or StarterGui it is being accessed through. Putting the sound in the Backpack or StarterGui makes it local which means only one player can hear it at a time.

In order to make a sound begin playing for a single player you would need to do something like this but alter it depending on where you place the sound:

game.Players[plr].PlayerGui.Sound2:Play() --"plr" would be the name of the player that you are trying to access and you use PlayerGui instead of StarterGui as once the starting graphics are added to the player, they are known as the Player's graphics or PlayerGui

3 comments

0

So what would I replace plr with?

0

You would replace it with the name of the owner that you would want to play the sound for. You should be able to figure that part out on your own.

0

Oh, I understand thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.