Npc doesn't move from the client

So I’m trying to move the npc with pretty much the same code as the player but it doesn’t work
(client sided script)

local rs = game:GetService("RunService")

rs.RenderStepped:connect(function()
		
		if hum.Health > 0 then
			hum:Move(Vector3.new(1,0,0), false)  -- moving for the player	
		end
		
		for i,v in pairs(workspace.Zombies:GetChildren()) do
			if v.Humanoid.Health > 0 then
				v.Humanoid.WalkSpeed = workspace.Player:FindFirstChildWhichIsA("Model").Humanoid.WalkSpeed
				v.Humanoid:Move(Vector3.new(1,0,0), false) -- not moving for the npcs	
				print("Hey") -- yes it prints this
			end
		end
		
	end)

and I also set the enemys body parts owner ship to the player (on the server, npc is also created on the server)

for i,v in pairs(npc:GetDescendants()) do
		if v:IsA("BasePart") then
			v:SetNetworkOwner(plr)
		end
	end

Video of the Problem:

Tell me if you need more info.

1 Like

Maybe add a task.wait()? or test it as a while loop.

1 Like

I mean it works for the player so that can’t be the problem

1 Like
local rs = game:GetService("RunService")

rs.RenderStepped:Connect(function()
    local player = game.Players.LocalPlayer
    local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid")

    if hum and hum.Health > 0 then
        hum:Move(Vector3.new(1, 0, 0), false) -- moving for the player
    end

    for i, v in pairs(workspace.Zombies:GetChildren()) do
        local npcHumanoid = v:FindFirstChildOfClass("Humanoid")
        if npcHumanoid and npcHumanoid.Health > 0 then
            npcHumanoid.WalkSpeed = workspace.Player:FindFirstChildWhichIsA("Model").Humanoid.WalkSpeed
            npcHumanoid:Move(Vector3.new(1, 0, 0), false) -- moving for the NPCs
            print("Hey")
        end
    end
end)

Use the humanoid from the NPC directly: Instead of accessing the NPC’s humanoid through v.Humanoid , you can directly use v:Move() for simplicity.

1 Like

didn’t change anything from the outcome

1 Like

I saw this in your output when your player touched the NPC
image

1 Like

Npc looks anchored by the way it’s just floating there.

1 Like

yea thats what I mean the code is running but the npc isn’t moving

1 Like

it isn’t anchored already checked

1 Like

Thats becuase you tried running a Http request on the client.

1 Like

Huh? What do you mean by that?

That error you got, you are trying to make an HTTP request from the client-side script, which is not allowed in Roblox. HTTP requests should be made from the server side.

1 Like

oh you mean that, I always get that in every project I have. Or can you tell me what I should do about it?

/

I guess its just from one of my plugins

1 Like

this still hasn’t been solved yet

1 Like

Can you send me the local scripts for the NPC because thats the main issue I am pretty sure. I can use RemoteEvents to call a request from the server to the client.

1 Like

Wdym? I don’t have a specific local script for the npc.

1 Like

Well whatever it is that error in the output shows up when you touch the NPC, which means it haves something to do with a client script, How about press on the error and see what script it takes you to.

it also appears before touching the npc…

I just tested server and client
For my tests it only works if the model was created on the client and running on the client
and same with the server
created by server and moved by server

Are you able to create the model of the character on the client?

I mean yea sure thats probably one way, but why can you set the NetworkOwner then?