RemoteEvent is quicker than player position update

Hello guys,

I’m wondering if I’m doing something wrong or if this is a bug.
Even with no lag enabled in studio, I do this :
Client

  • Fire event to server (skill begin)
  • Compute position to reach
  • Tween player cframe to the position (tween.Completed:Wait())
  • Fire event to server (skill end)

And even when the server is just do print on the character position, the problem is that they are the same between OnServerSkillBegin and OnServerSkillEnd. Except if I add a task.wait(x) before firing the second event.

What is this sorcery?
I’m kinda rolling my head on the keyboard. Don’t tell me both action communicate in parrallel? Or is it because I use the CFrame ?

Thanks anyway !
(Btw it’s because I have a dash skill and I want to make sure the player didn’t cheat, while being responsive… so “physic” on the client side)

may i see the code?
Assuming you are doing something wrong

Draft code, but should be understandable I think :

	SReplicated.Skills.RemoteEvent:FireServer()
	local result = test.ComputeDestination(character.PrimaryPart.Position, character.PrimaryPart.CFrame.LookVector, 20)
	
	character.Humanoid.PlatformStand = true
	character.PrimaryPart.Anchored = true
	
	local offset = result - character.HumanoidRootPart.CFrame.Position
	local tweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Linear)
	local tween = STween:Create(character.HumanoidRootPart, tweenInfo, { CFrame = CFrame.new(result) * character.PrimaryPart.CFrame.Rotation })
	
	tween:Play()
	tween.Completed:Wait()
	

	character.Humanoid.PlatformStand = false
	character.HumanoidRootPart.Anchored = false
	--task.wait(0.5) Should not be necessary
	SReplicated.Skills.RemoteEventEnd:FireServer()

could put everything inside tween.Completed event

tween.Completed:Connect(function()
    character.Humanoid.PlatformStand = false
	character.HumanoidRootPart.Anchored = false
	SReplicated.Skills.RemoteEventEnd:FireServer()
end)

Done but nothing different :frowning:
Should I provide a small project ?

If I keep trying to move the character while it’s anchored, I also have a really weird thing like the first event doesn’t print the same value unlike the second and the player (bedfore the tween).

Just press E and you’ll see 4 print calls
RemoteEventIssue.rbxl (54.8 KB)

Client print just before firing the event

Ps : I tried to remove the tween just “to be sure”, didn’t change a thing

1 Like

Can you explain what your issue is a little more?

I suppose there is no way around it. You can’t possibly know when the character’s position will be replicated, so it is basically unreliable. You should do the character’s movement on the server instead. Try and look for the most optimized solution (VectorForce perhaps? Or maybe ever LinearVelocity…)

That’s what I was doing before, but the feedback is dependant of the ping :frowning:
Let me hope a bit longer than there is something else.
I openned another thread for the more general question. Thanks!

1 Like

Basically making sure that the client didn’t do… bad things.

With Roblox’s current character system, the client will always have authority of their character physics so I don’t think its worth trying to make an anti cheat for a dash ability. I think the best choice would be to handle all of it on the client.

The dash was just the basic example of a movement ability, it works for everything.

Well after been really sad, I think my only solution is to implement the shadow system I was thinking about. Which means that when the starting event is received by the server, it activate a clone of the player doing the same thing that the player should be doing. The shadow become the target for hits, and at the end the delta between the shadow and the player is computed and some other logic is applied. Basically the server is the only truth, triggered by the first event.

I won’t give up @PhoenixRessusection !

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.