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

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

Asked by 9 years ago

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

Log in to vote
1
Answered by 9 years ago

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
0
So what would I replace plr with? TixyScripter 115 — 9y
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. FearMeIAmLag 1161 — 9y
0
Oh, I understand thanks! TixyScripter 115 — 9y
Ad

Answer this question