I made a grab move which requires two players to be in a certain position in order for the animation to play flawlessly. However, when I try to put Player1 directly behind Player2, it doesn’t always happen as expected.
This is what happens when there is no movement from both players prior the grab animation:
The player positions himself behind the enemy player, as expected.
This is what happens when both players are moving before the grab animation:
You can clearly see a difference between these two. In the second video, the player is not positionned accurately as he should be from the enemy player.
That’s cool game i guess lol
you need Edit the script Like That
Before Editt Script:
the real script: yRoot.Anchored = true
MyCharacter.Humanoid.AutoRotate = false
enemyChar.Humanoid.AutoRotate = false
enemyChar.HumanoidRootPart.Anchored = true
local bdAnim = MyCharacter.Humanoid.Animator:LoadAnimation(KCGrab)
local enemybd = enemyChar.Humanoid.Animator:LoadAnimation(KCTarget)
MyRoot.CFrame = enemyHumrp.CFrame * CFrame.new(0,0,5)
bdAnim:Play()
enemybd:Play()
script after edited yRoot.Anchored = true
MyCharacter.Humanoid.AutoRotate = Truse
enemyChar.Humanoid.AutoRotate = false
enemyChar.HumanoidRootPart.Anchored = true
local bdAnim = MyCharacter.Humanoid.Animator:LoadAnimation(KCGrab)
local enemybd = enemyChar.Humanoid.Animator:LoadAnimation(KCTarget)
MyRoot.CFrame = enemyHumrp.CFrame * CFrame.new(5,1,5) ** You Can change it to any number if u wan
bdAnim:Play(2) = theres the sconda player side
enemybd:Play(1) = ( here your one player side:
I am not sure about this script but i hope its work!
I’m gonna be honest with you, I have no idea what you just said or how your script is supposed to fix my issue, but I appreciate your time. The issue was already solved, all I had to do was set the CFrame of the players locally.
Quick experiment if you want to see the reason:
Create a userinputservice with a remote event that fires when you click or act on it, create a part in your position as soon as it happens as well for reference.
While doing so, move in any direction.
On the server, get that remote event call and create a part on your rootpos on the server side as well. (Don’t pass client cframe to server, it should have player argument you can use to get character from server.)
Now compare the positions of the local part to the server part.
Didn’t do it? Simplified:
When you attack, client gets cframe immediately and gets everything in position as you click it.
Server only gets it ONCE it registers a event call from client. If client lags, so does the call.
Once server gets it, the call would’ve been delayed from the time the client called. This can be very noticeable if the player has very high ping.