#Arms bugging after played animation

1 messages · Page 1 of 1 (latest)

steel silo
#

I got a bug in my climbing script when my character climbs the wall his arms bug a lot and look like a zombie. If you need the code ask me.

steel silo
#

-- LocalScript (StarterPlayerScripts)
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")

-- SETTINGS
HANG_KEY = Enum.KeyCode.E
local WALL_DISTANCE = 6
local MAX_LEDGE_HEIGHT = 10
local HANG_OFFSET_Y = 2
local HANG_FORWARD_OFFSET = 0.45
local HANG_TIME = 0.25
local CLIMB_TIME = 0.45
local COOLDOWN = 0.5

#

-- ANIMATIONS
local ANIM_HANG_ID = "rbxassetid://91092086452425"
local ANIM_CLIMB_ID = "rbxassetid://101596409017664"

local hangAnim = Instance.new("Animation")
hangAnim.AnimationId = ANIM_HANG_ID

local climbAnim = Instance.new("Animation")
climbAnim.AnimationId = ANIM_CLIMB_ID

-- STATE
local canHang = true
local isHanging = false
local hangCFrame = nil
local hangConnection = nil
local wallReference = nil
local currentLedgePos = nil
local currentForward = nil

#

-- FIND LEDGE
local function findLedge()
local rayParams = RaycastParams.new()
rayParams.FilterDescendantsInstances = {character}
rayParams.FilterType = Enum.RaycastFilterType.Blacklist

local origin = rootPart.Position + Vector3.new(0, 2, 0)
local direction = rootPart.CFrame.LookVector * WALL_DISTANCE
local wallHit = workspace:Raycast(origin, direction, rayParams)
if not wallHit then return end

local topOrigin = wallHit.Position + Vector3.new(0, MAX_LEDGE_HEIGHT, 0)
local downRay = workspace:Raycast(topOrigin, Vector3.new(0, -MAX_LEDGE_HEIGHT * 2, 0), rayParams)
if downRay then
    return wallHit.Instance, downRay.Position
end

end

-- CLIMB FUNCTION
local function doClimb()
if not isHanging or not currentLedgePos or not currentForward then return end

isHanging = false
#

-- Disconnect RenderStepped freezing BEFORE tweening
if hangConnection then
hangConnection:Disconnect()
hangConnection = nil
end

if wallReference then
    wallReference.CanCollide = true
    wallReference = nil
end

print("⬆️ Climbing up")
humanoid.PlatformStand = false

local climbTrack = humanoid:LoadAnimation(climbAnim)
climbTrack:Play()

local climbPos = Vector3.new(currentLedgePos.X, currentLedgePos.Y + 2, currentLedgePos.Z) + currentForward * 2
local climbTween = TweenService:Create(
    rootPart,
    TweenInfo.new(CLIMB_TIME, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
    {CFrame = CFrame.new(climbPos, climbPos + currentForward)}
)
climbTween:Play()
climbTween.Completed:Connect(function()
    climbTrack:Stop()
    print("✅ Climb complete")
end)

end

#

-- HANG FUNCTION
local function doHang()
if not canHang or isHanging then return end

local wall, ledgePos = findLedge()
if not wall or not ledgePos then return end

canHang = false
isHanging = true
wallReference = wall
currentLedgePos = ledgePos

print("🧗 Hanging started")

-- Disable wall collisions for smooth movement
wall.CanCollide = false

-- Play hang animation
local hangTrack = humanoid:LoadAnimation(hangAnim)
hangTrack:Play()

-- Flatten forward vector for upright rotation
local forward = rootPart.CFrame.LookVector
forward = Vector3.new(forward.X, 0, forward.Z).Unit
currentForward = forward

-- Compute hang CFrame
hangCFrame = CFrame.new(
    ledgePos - Vector3.new(0, HANG_OFFSET_Y, 0) - forward * HANG_FORWARD_OFFSET,
    ledgePos - Vector3.new(0, HANG_OFFSET_Y, 0) + forward
)

-- Tween to hang position
local tween = TweenService:Create(
    rootPart,
    TweenInfo.new(HANG_TIME, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
    {CFrame = hangCFrame}
)
tween:Play()
#

-- Keep frozen at hangCFrame
hangConnection = RunService.RenderStepped:Connect(function()
if isHanging and hangCFrame then
rootPart.CFrame = hangCFrame
rootPart.Velocity = Vector3.zero
rootPart.RotVelocity = Vector3.zero
end
end)

-- Safety release after 6 seconds
task.delay(6, function()
    if isHanging then
        isHanging = false
        if hangConnection then hangConnection:Disconnect() end
        hangTrack:Stop()
        if wallReference then
            wallReference.CanCollide = true
            wallReference = nil
        end
        print("⌛ Auto release")
    end
    task.delay(COOLDOWN, function()
        canHang = true
    end)
end)

end

-- INPUT: Hang and Climb
UserInputService.InputBegan:Connect(function(input, gp)
if gp then return end

if input.KeyCode == HANG_KEY then
    doHang()
elseif input.KeyCode == Enum.KeyCode.Space and isHanging then
    doClimb()
end

end)

timid forgeBOT
#

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

steel silo
#

Here is everything

regal cargo
#

thanks

regal cargo
steel silo
#

Want me to show u

#

A video

regal cargo
#

like after the climb the climb anim playing countinous

steel silo
#

No the anim ends

#

But the arms bug

#

Lemme show u

regal cargo
#

ok

steel silo
regal cargo
# steel silo

i suggest u make another animation if u don't have for idle, if u have already use that and put it after u stop climbim u can add a function that makes you that

timid forgeBOT
#

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

steel silo
regal cargo
#

yeah

steel silo
#

Also walk?

#

Cuz it also does it whilst walking

regal cargo
#

if is need yes

steel silo
#

ok ty for the help

regal cargo
#

np

plush valley
#

Set your climbing animation to a higher priority than the climbing animation,

#

you can do this in-code aswell.

steel silo
#

hm

#

I’ll try ty

plush valley
#

Unless your editing the Motor6D's of the player directly then at this point re-do the whole thing.

#

and since your code is mostly AI...

#

im not bothering to read through it

steel silo
#

I use Roblox studio built in animator

plush valley
steel silo
#

I only know basics on Roblox studio broskito

#

Im tryna learn

plush valley
#

Then you gotta learn a bittttt more

#

Still,

#

It's either two things

steel silo
#

I put the hang anim on action and the climb action2 but now he has hands upwards

timid forgeBOT
#

studio** You are now Level 2! **studio

plush valley
#

AnimationPriority's clashing with eachother

#

Orrrr

steel silo
plush valley
#

You're setting it up via CFrames, and/or using the Motor6D directly, which then you should probably re-do here

steel silo
plush valley
#

It's not something advanced

steel silo
#

I know I’m just joking

plush valley
#

But either way, i hope those two can find out your issue with your script.

steel silo
#

Alright I’ll try and if somethings wrong I’ll ask here