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

Roblox cannot find PlayerScripts inside Player?

Asked by 7 years ago

I am trying to make a script where the music changes from place to place where you go and I have the music located inside PlayerScripts. Here is my script, can someone help me correct it?

script.Parent.Touched:connect(function(hit)
game.Players:getPlayerFromCharacter(hit.Parent):FindFirstChild("PlayerScripts").Music.SoundId = 'http://www.roblox.com/asset/?id=447887719'
end)
0
there is also a .Music.SoundId that is behind playerscripts that didnt show up on the screen. Tybearic 18 — 7y
1
There is a chance that 'hit.Parent' isn't a Character. Try checking if the GetPlayerFromCharacter function returns nil prior to trying to find the PlayerScripts. Goulstem 8144 — 7y

Answer this question