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)

2 comments

0

there is also a .Music.SoundId that is behind playerscripts that didnt show up on the screen.

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.