I want to make a non humanoid npc to because humanoid npc’s cause performance issues
I’m moving the npc’s on the client so the movement is smooth
I want all players too see the same thing the issue is I don’t know where to start
right now I’m thinking about moving the npc small distances on the server basically teleporting and the client moves the npc to the new position
I’m not sure how to go about this or where to start though.
Update positions at fixed intervals (e.g. every 0.1 seconds) using RunService.Heartbeat
Send position updates via RemoteEvents only when NPCs change direction or reach waypoints
Use a table to track NPC data: {id, position, targetPosition, speed}
Client:
Receive position updates and interpolate between them
Use RenderStepped for smooth movement
Predict NPC positions based on last known velocity
Example:
local NPCs = {}
local UPDATE_RATE = 0.1
RunService.Heartbeat:Connect(function(dt)
for id, npc in NPCs do
-- Move NPC toward target
local direction = (npc.targetPos - npc.currentPos).Unit
npc.currentPos = npc.currentPos + direction * npc.speed * dt
-- Only send updates on significant changes
if (npc.currentPos - npc.lastSentPos).Magnitude > 5 then
RemoteEvent:FireAllClients(id, npc.currentPos, npc.targetPos, npc.speed)
npc.lastSentPos = npc.currentPos
end
end
end)
If you need any more specifics on implementing this lmk