Hello, I am trying to figure out something that deals with Sound. I currently have this following script to play sound for only one person, not all of the other people.
game.Players[script.Parent.Owner.Value].PlayerGui.Sound2:Play()
I used this in my Tycoon kit but it caused different errors, so I was wondering was there any possible way to make the sound be louder the closer you get? Instead of playing at the same Volume through-out the entire game? If you know how please help! Thanks.
Error in Output - Workspace.Berezaa's Tycoon Kit.Tycoons.Bright blue.Purchase:79: bad argument #2 to '?' (string expected, got user data) Script 'Workspace.Berezaa's Tycoon Kit.Tycoons.Bright blue.Purchase', Line 79 Stack end
That's what came up when I touched the button with the script above, it just made the Model that you buy appear but no sound nor did the button disappear...
script.Parent.Owner.Value
is an ObjectValue! It already returns the player object. You don't need to search in game.Players
for it.
script.Parent.Owner.Value.PlayerGui:WaitForChild('Sound2'):Play()
Can you list the errors?