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
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.
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.
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.
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.
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?