What do you want to achieve?
– trying to figure out how to make my 2d player replication more accurate or fast, when players move it looks different then what its suppost to and i dont know what to do
What is the issue?
– video
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
– i tryed switching from remote event to remote function; idk how else to go about this
–for refrence this is what i did (just half of it)
RunService.RenderStepped:Connect(function(Delta)
local MoveX = 0
local MoveY = 0
-- theres other stuff before this that i removed but, it just moves the background for you,, other players get moved
local MoveVector = Vector2.new(MoveX, MoveY)
if MoveVector.Magnitude > 0 then
MoveVector = MoveVector.Unit
end
local StepVelocity = MoveVector * MoveSpeed * Delta
MoveOffset += StepVelocity
Map.Position = UDim2.new(
Map.Position.X.Scale,
InitialOffsetX - MoveOffset.X,
Map.Position.Y.Scale,
InitialOffsetY - MoveOffset.Y
)
local success, result = pcall(function()
getPosition:FireServer(Vector2.new(
-Map.Position.X.Offset + InitialOffsetX,
-Map.Position.Y.Offset + InitialOffsetY
))
end)
--ths sends positions to server so other players can recieve and see you move
end)
you can use buffers, that will slightly make it faster
but overall you wont have ideal, cause it takes time for your data to travel to server, and the server data travel to everyone else
another thing what you are doing is using GuiObject position values, which is horrible
you need a good ECS with schedular start, i have a template for this i think and it has replication
its sending the position every frame? how does it become out of sync then? switch to unreliable remote events instead, they are better for this sort of thing. u cant fully eliminate ping but the players not being in the same pos is a different issue from ping/latency.
I’d try getting data from movedirection of their characters since characters are being rendered first of all, so if player moves a stud(and he won’t see that), you will read that and change position with that locally since it replicates immediately.
this is a structural problem not network speed problem. you need network interpolation and lag compensation (aka input prediction). like if the other user does +Right at 100 units a second and gives also a position, and your client knows only the input and the latency it took, you can transpose their position by their acceleration/speed * their ping to put them further than they actually are - which will be where they likely already are.