Humanoid not moving after reset

I’ve encountered an issue with my Pets where-in they don’t seem to move after a reset and insertion of a new model:

My script works by: Inserting the Pet server side, setting Ownership to the Player and managing movement via the client.

So far, after testing I’ve come to realise the issue may be Client based - as without the ‘RenderStepped’ the Humanoid will move to the set Vector, however with it - It will not. Not even while true() works.

EDIT: - After messing around with it, and even wrapping the code in Spawn(functions()) and coroutine, I can confirm it still has not worked. I’ve attached the Model if anyone could take a look I would be grateful.Follow_.rbxm (111.5 KB)

Server script
local Pets = Instance.new("Folder", workspace)
Pets.Name = "Player_Followers"

    local Main = script.Kangop:Clone()

    game.Players.PlayerAdded:Connect(function(NewPlayer)
    	NewPlayer.CharacterAdded:Connect(function(NewCharacter)
    	
    	local Model = Main:Clone()
    	Model.Parent = Pets
    	
    	local Owner = Instance.new("ObjectValue", Model:WaitForChild("Follower"))
    	Owner.Name, Owner.Value = "Owner", game.Players:GetPlayerFromCharacter(NewCharacter)
    	
    	NewCharacter:WaitForChild("Humanoid").HealthChanged:Connect(function(Health)
    		if Health == 0 then Model:Destroy() else end
    	end)
    	
    	for _,Parts in pairs (Model:GetDescendants()) do
    	if Parts:IsA("BasePart") and Parts.Anchored == false then
    	Parts:SetNetworkOwner(game.Players:GetPlayerFromCharacter(NewCharacter))
    	else end
    	end
    	
    	NewPlayer:WaitForChild("PlayerGui"):WaitForChild("Evolyt_Controls").Follow:FireClient(game.Players:GetPlayerFromCharacter(NewCharacter), Model)
    	end)
    end)
Client script
local Main = script.Parent
local Player = game.Players.LocalPlayer
local Player_Followers = workspace:WaitForChild("Player_Followers")

function Animate_Model(Model)
	spawn(function()
	require(Model:WaitForChild("Animate")).Configure()
	end)
end

for _,v in pairs (Player_Followers:GetChildren()) do
	if v then
		if v:IsA("Model") and v:FindFirstChild("Animate") ~= nil then
		if v:WaitForChild("Follower").Owner.Value == Player then
		else Animate_Model(v) end
		else return end
	else return end
end

Player_Followers.ChildAdded:Connect(function(NewChild)
	if NewChild:IsA("Model") and NewChild:FindFirstChild("Animate") ~= nil then
	Animate_Model(NewChild)
	else return end
end)

Main:WaitForChild("Follow").OnClientEvent:Connect(function(Model)
	local HumanoidRootPart = Player.Character:WaitForChild("HumanoidRootPart")
	
	game:GetService("RunService").RenderStepped:Connect(function()
	Model:WaitForChild("Follower"):MoveTo(Vector3.new(10, 10, 10))
	end)

end)

1 Like

That seems seriously over complicated to me.

I’d do it this way. I’d have pets in ServerStorage.

When the player joins (CharacterAdded), or when the player adds a pet, I would clone it to workspace and then teleport it by setting it’s position to player position and offset it. After that, I would have either that offset as my target position for the pet if I wanted it to always be in like a 5 pointed star shape around the player, or I would have it then just have a if distance is greater than 7, pathfind to player position. If playerhealth = 0, destroy.

But I’m a beginner so I may not know what I’m talking about. I just go with common sense simple stuff. Because if it gets too complex, I can’t work with it. I just like the simplest way to do something without all the complicated stuff.

2 Likes