So I am trying to make a script for a handcuff tool, I don't know much about CFrames but I managed to do this:
[Remote Event]
local offset = CFrame.new(0,0,-2.2) local char1 = selectedPlr.Character --(The character of the "cuffed" player) local char2 = plr.Character -- (The character of the player with cuffs) char1.HumanoidRootPart.CFrame = char2.HumanoidRootPart.CFrame:ToWorldSpace(offset)
This does what I want, and places the "cuffed" player in front of the one with the tool. Image
Now the problem is.. how do I make the cuffed player move as if it was welded to the other?
WeldConstraint didn't work as expected so what should I use?
Use a loop and a variable " cuffed". You'll have to figure out how to enable and disable the variable.
local offset = CFrame.new(0,0,-2.2) local char1 = selectedPlr.Character --(The character of the "cuffed" player) local char2 = plr.Character -- (The character of the player with cuffs) char1:GetMouse( cuffed = false game:GetService("RunService").Stepped:Connect(function() if cuffed == true then char1.HumanoidRootPart.CFrame = char2.HumanoidRootPart.CFrame:ToWorldSpace(offset) end end
(Edit to make the player non collidable:)
for i,v in pairs(char1:GetDescendants()) do if v:IsA("Part") then v.CanCollide = false end end