I'm using a RopeConstraint as handcuffs so when you click on a player with the handcuffs, you can jail them and pull them wherever you would like. However it gets glitchy and the jailed person can actually move by pulling the handcuff holder when he's not moving. I've tried attaching the constraints to the HumanoidRootPart, Legs, Arms, Torso and even the tool itself but none of them solve this problem. Its filtering enabled compatible currently. And if anyone knows how to solve the problem with me still being able to use the tool once I've unequipped it for the first time, please let me know.
**-- Local Script** Player = game.Players.LocalPlayer mouse = Player:GetMouse() debounce = false anim = game.ReplicatedStorage.Caught script.Parent.Equipped:Connect(function() mouse.Button1Down:Connect(function() if mouse.Target ~= nil then local Hit = mouse.Target print("hi") if Hit.Name == ("Torso") or Hit.Name == ("Head") or Hit.Name == ("Left Leg") or Hit.Name == ("Right Leg") or Hit.Name == ("HumanoidRootPart") or Hit.Name == ("Left Arm") or Hit.Name == ("Right Arm") then print("hi") local Jailed = Hit.Parent local Jailed2 = Jailed:FindFirstChild("HumanoidRootPart") local Jailed1 = Player.Character.Tool.Handle script.Parent.RemoteEvent:FireServer(mouse,anim,Jailed,Jailed2,Jailed1,Hit) end end end) end) **-- Script** script.Parent.RemoteEvent.OnServerEvent:Connect(function(Player,mouse,anim,Jailed,Jailed2,Jailed1,Hit) print("hi") local attachmentB = Instance.new("Attachment",Jailed2) local attachmentA = Instance.new("Attachment",Jailed1) attachmentA.Position = Vector3.new(1,-0.7,0.3) attachmentB.Position = Vector3.new(0,0,0.3) print("hi") local ropeConstraint = Instance.new("RopeConstraint",Jailed1) ropeConstraint.Attachment0 = attachmentA ropeConstraint.Attachment1 = attachmentB ropeConstraint.Length = 10 ropeConstraint.Visible = true ropeConstraint.Color = BrickColor.Black() ropeConstraint.Thickness = 0.2 ropeConstraint.Restitution = 0.5 Jailed.Humanoid.Walkspeed = 0 local caught = Jailed.Humanoid:LoadAnimation(anim) caught:Play() script.Parent.Unequipped:Connect(function() ropeConstraint:Destroy() caught:Stop() Jailed.Humanoid.Walkspeed end) end)
Create an invisible, anchored, non-collidable Part that is continuously updated to have its Position equal to the torso of the one holding the handcuffs.
The reason you can still use the tool after unequipping is because you never destroy the connection you made to mouse.Button1Down.
--Near top local con --Line 10: con = mouse.Button1Down:Connect(function() --At end of LocalScript: script.Parent.Unequipped:Connect(function() if con then con:Disconnect() con = nil end end)
Also, you shouldn't connect to events within other events (server-script, line 46) -- you'll end up making more than one connection over time. Instead, use a boolean variable, like this:
local isCaught = false local ropeConstraint, caught, jailed function CaughtDone() if isCaught then ropeConstraint:Destroy() caught:Stop() jailed.Humanoid.Walkspeed = 15 -- or whatever end isCaught = false end --At the beginning of the RemoteEvent: CaughtDone() -- clean up any previous handcuffing --Right after "caught:Play()": isCaught = true jailed = Jailed -- store who is Jailed in the 'jailed' variable so that 'CaughtDone' has access to it --Delete the script.Parent.Unequipped block --At the end of the script: script.Parent.Unequipped:Connect(CaughtDone)