You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to be able to send less data to the clients. -
What is the issue? Include screenshots / videos if possible!
The server sends around 7.7kb per enemy, and thats way too much. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried many things, nothing worked. Dev Hub gave nothing.
Here is my current code:
rus.Heartbeat:ConnectParallel(function(dt)
for i, v in pairs(enemyz) do
local direction = (v.Target.Value.Position - v:GetAttribute("Pos")).Unit
local moveAmount = direction * v:GetAttribute("Speed") * dt
local result = v:GetAttribute("Cf") + moveAmount
if (v:GetAttribute("Pos") - v.Target.Value.Position).Magnitude > .1 then
task.synchronize()
v:SetAttribute("Cf",v:GetAttribute("Cf") + moveAmount)
v:SetAttribute("Pos",(v:GetAttribute("Cf") + moveAmount).Position)
remote:FireAllClients({v.Name,result})
else
task.synchronize()
v.Target.Value = workspace.TestMap.Track.PathfindingLocations:FindFirstChild(v:GetAttribute("Target") + 1)
end
end
end)