Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with making a player's pet follow them after they reset?

I am making a pet system, but I need the pets to still follow the "New" character after they reset, instead of the "Old" character. It only works once, then the pet only follows the old character. Here is the script (It is FilteringEnabled also)

game.Players.PlayerAdded:connect(function(Player)
 local character = Player.Character or Player.CharacterAdded:wait()
 character:WaitForChild("Humanoid").Died:connect(function()
	local Doge = game.workspace:FindFirstChild(Player.Name.."Dog")
	wait(6)
	Doge.RocketPropulsion:Abort()
	Doge.RocketPropulsion.Target = Player.character.Torso
	Doge.RocketPropulsion:Fire()
	end)
end)

1 answer

✓ Accepted answer
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local doge=workspace[player.Name..'Dog']
		Doge.RocketPropulsion:Abort()
		Doge.RocketPropulsion.Target=character.Torso
		Doge.RocketPropulsion:Fire()
	end)
end)

should work

1 comment

0

Thanks soooo much! It helped alot and works in multiplayer too!

This discussion is preserved as it was. New answers, comments, and votes are closed.