I'm trying to figure out what's wrong with my script and why it's not removing the sound script as well as not changing the walkspeed within the Player after they respawn. Any help?
function onPlayerEntered(player) repeat wait () until player.Character ~= nil Player.Character.Sound:Destroy() Player.Character.Humanoid.WalkSpeed = 5 player.CharacterAdded:connect(function (char) Player.Character.Sound:Destroy() Player.Character.Humanoid.WalkSpeed = 5 end) end game.Players.PlayerAdded:connect(onPlayerEntered)
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function (char) char:WaitForChild("Sound"):Destroy() char:WaitForChild("Humanoid").WalkSpeed = 5 end) end)
This should work your script probably broke and ran to early.
function onPlayerEntered(player) repeat wait () until player.Character ~= nil Player.Character.Sound:Destroy() Player.Character.Humanoid.WalkSpeed = 5 Player.CharacterAdded:connect(function (char) -- you had 'player' not 'Player' Player.Character.Sound:Destroy() Player.Character.Humanoid.WalkSpeed = 5 end) end game.Players.PlayerAdded:connect(onPlayerEntered)
This should work now.
The first time a player joins, it removes the sound, then after that, it removes it again when the character joins the workspace. you just got to remove lines 3 and 4.