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

Can you help me with Sound Properties?

Asked by 8 years ago

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...

2 answers

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
8 years ago

Your Problem

script.Parent.Owner.Value is an ObjectValue! It already returns the player object. You don't need to search in game.Players for it.


Code

script.Parent.Owner.Value.PlayerGui:WaitForChild('Sound2'):Play()
0
I dont think this is a problem in your scripting, but it says Sound2 is not a valid member of PlayerGui? TixyScripter 115 — 8y
0
That just means that it's not there. I edited the script to use WaitForChild Goulstem 8144 — 8y
0
idek why but its the same error everytime.. TixyScripter 115 — 8y
0
That means that the sound just isn't there. Goulstem 8144 — 8y
Ad
Log in to vote
-1
Answered by 8 years ago

Can you list the errors?

0
Edited! TixyScripter 115 — 8y
0
Move the sound to Sounds. Dev_Tony 15 — 8y

Answer this question