What do you want to achieve?
I want to connect 2 parts with a rope:
- First part is an anchored part that moves by setting CFrames
- Second part is a HumanoidRootPart of n character
I want to achieve this without causing desync.
I am creating an additional part to make sure that an exploiter can’t affect the other player using the rope, I know it only eliminates the connected player but it’s better than nothing
What is the issue?
The issue is that connecting a part to an anchored part with a rope causes desync.
Here are videos which demonstrate the issue:
- With 2 dummies (server owned and player owned) and server point of view
- With another player and both point of views
In the first video the issues is still present in BOTH dummies because:
The dummy that is owned by the server:
- Stays in place in player’s POV
- Moves around behind the player in server’s POV
And the dummy that is owned by the player:
- Moves around behind the player in player’s POV
- Stays in place in server’s POV
What solutions have you tried so far?
This issue can be solved by replacing anchoring with AlignOrientation and AlignPosition but the anchored version seems more exploiter proof and is way more clean to do, but I will do it if I can’t find another way.
Another solution I thought of was to force update the position on each client with remote events but that would be a lot of remote firing and I don’t know if it would be the efficient to do that
This is the script which creates the rope. I can’t include the full script since it uses functions and classes which would need more explaining so I just shortened it to the most important bits.
This is in a server script:
-- u_root is the hrp of the person using the move (is dragging the other person with the rope)
-- h_root is the hrp of the person who got hit by the move (is being dragged with the rope)
-- Create attachments for the rope
local h_att = Instance.new("Attachment")
h_att.Parent = h_root
local u_att = Instance.new("Attachment")
u_att.Parent = part
-- Create follow part
local part = Instance.new("Part")
part.Size = Vector3.new(1,1,1)
part.Transparency = 0
part.Color = Color3.fromRGB(255,0,0)
part.CanCollide = false
part.CanQuery = false
part.CanTouch = false
part.Anchored = true
part.CFrame = u_root.CFrame
part.Parent = debris_folder
-- Make follow part follow the player
UniversalUtils.followPart(part, u_root, CFrame.new(0,0,0)) -- Makes the part follow u_root with 0,0,0 offset
-- Create rope
local rope = Instance.new("RopeConstraint")
rope.Visible = true
rope.Color = BrickColor.new("Tr. Green")
rope.Length = 8
rope.Restitution = 0.125
rope.Attachment0 = u_att
rope.Attachment1 = h_att
rope.Parent = part
EDIT:
Another important thing I didn’t mention is that if the person that is dragging the other player stops moving for roughly 2/3 seconds the positions update to the correct ones.