im making a game where you get a pet same avatar as you but when other player joins he doesnt get pet and the 1st players pet gets changed to the 2nd players avatar

Code:

game.Players.PlayerAdded:Connect(function(plr)
	local char = game.ServerStorage:WaitForChild("Pet")
	local charclone = char:Clone()
	charclone.Name = plr.Name.." Pet"
	charclone.HumanoidRootPart.Position = Vector3.new(plr.Character)
	charclone.Parent = workspace

	local humanoid = charclone.Humanoid
	local playerId = (plr.UserId)
	humanoid:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(playerId))
	while wait(0.1) do
		charclone.Humanoid:MoveTo((game.Workspace:WaitForChild(plr.Name).HumanoidRootPart.CFrame*CFrame.new(0,0,3)).p)
	end
end)


2 comments

0

Any errors coming from it in the output?

0

nope