#Why are player look glitchy and staying behind me and why player are flipped 90 degree!?

1 messages · Page 1 of 1 (latest)

buoyant knot
#
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)

https://gyazo.com/f90ae65e47d95dd595389bd4d829ccc5

cobalt hemlock
#

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

sinful cobaltBOT
#

studio** You are now Level 1! **studio

buoyant knot
#

im lazy to fix uhm

#

Is there any better way

feral cosmos
#

also why are you using alignOrientation and alignPosition when you could be using a weld or weldconstraint instead

#

seems a bit unoptimized

buoyant knot
civic cradle
#

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

civic cradle
#

instead weld the target player to the attachment