I’m making a detain system and everything’s working, expect when you for example spin around and undetain the player, the player somehow teleports to another position.
The video for it is here: https://gyazo.com/4db50a2c0608dfb1582c7a4c79595157
the undetain script (A bit shortened):
function unDetain(playerGettingDetained)
local playerGettingDetainedCharater = playerGettingDetained.Character or playerGettingDetained.CharacterAdded:Wait()
for _, charPart in pairs(playerGettingDetainedCharacter:GetDescendants()) do
if charPart:IsA("BasePart") or charPart:IsA("MeshPart") or charPart:IsA("UnionOperation") then
charPart.Massless = false
charPart:SetNetworkOwner(playerGettingDetained)
end
end
playerGettingDetainedCharacter.HumanoidRootPart.WeldConstraint:Destroy()
unDetainClientRemote:FireClient(playerGettingDetained)
end```
(the undetainClientRemote just sets PlatformStand to false and changes the state of the humanoid to RunningNoPhysics on the client)
thats because the client is ahead of the server, so what you’re seeing when u spin around is where the other player is on your client while where the other player ends up after being detached is the actual server location of the player
You probably have to use a RemoteEvent that passes the player’s character’s position, then set the un-detained character’s position to the one sent by the remote. It’s not really efficient, but if you really want it to be fine for the player that is detaining, this is probably the best way.
Yeah, the thing is that the server also sees it like the player detaining, so when the player gets undetained the server and the client undetaining him see the player teleporting