local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HandcuffEvent = ReplicatedStorage.RemoteEvent.Handcuff:WaitForChild("HandcuffEvent")
local function attachPlayerToTool(playerChar, tool)
local rootPart = playerChar:WaitForChild("HumanoidRootPart")
local toolHandle = tool:FindFirstChild("Handle") or tool:FindFirstChildWhichIsA("BasePart")
if not toolHandle then return end
local humanoid = playerChar:FindFirstChild("Humanoid")
if humanoid then
humanoid.PlatformStand = true
end
local attachTool = Instance.new("Attachment", toolHandle)
attachTool.Position = Vector3.new(0, 0, -2)
local attachPlayer = Instance.new("Attachment", rootPart)
local alignPos = Instance.new("AlignPosition", rootPart)
alignPos.Attachment0 = attachPlayer
alignPos.Attachment1 = attachTool
alignPos.RigidityEnabled = true
alignPos.MaxForce = 50000
alignPos.Responsiveness = 50
local alignOri = Instance.new("AlignOrientation", rootPart)
alignOri.Attachment0 = attachPlayer
alignOri.Attachment1 = attachTool
alignOri.MaxTorque = 50000
alignOri.Responsiveness = 50
end
local function playArrestAnimation(playerChar)
local animation = script:WaitForChild("Animation")
local humanoid = playerChar:WaitForChild("Humanoid")
local track = humanoid:LoadAnimation(animation)
track.Priority = Enum.AnimationPriority.Action
track:Play()
end
HandcuffEvent.OnServerEvent:Connect(function(playerWhoTriggered, targetPlayer)
if targetPlayer and targetPlayer.Character then
local tool = playerWhoTriggered.Character:FindFirstChildOfClass("Tool")
if tool then
attachPlayerToTool(targetPlayer.Character, tool)
playArrestAnimation(targetPlayer.Character)
end
end
end)
#Why are player look glitchy and staying behind me and why player are flipped 90 degree!?
1 messages · Page 1 of 1 (latest)
the grabbing object might have a rotated transform, and the grabbed object inherits that.
so i don't think anything is wrong with the script i think the tool is rotated
** You are now Level 1! **
oh
im lazy to fix uhm
Is there any better way
modify the alignOrientation to accomodate for the faulty transform
also why are you using alignOrientation and alignPosition when you could be using a weld or weldconstraint instead
seems a bit unoptimized
I figure this
which WORK, however it was causing the player to fall back behind and glitchy. I want something like this
https://sourceb.in/6iI18NmVqz
https://gyazo.com/e5545be9f2cc95d7da0a65e394ff503d
why alignposition
in the first video it works because he doesnt use alignposition
or align rotation
he just sets the cframe of the rootpart on the attachment
either by welding the root with an invisible part that follows the attachment
or per runservice
ur version is glitchy because of the align rotation
and that can also cause problems since the player is colliding with you or the ground
and that can cause to flings
just dont use alignPos/rotation
instead weld the target player to the attachment