#Arms bugging after played animation
1 messages · Page 1 of 1 (latest)
send the code
Here I’ll send it in parts
-- 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)
** You are now Level 1! **
Here is everything
thanks
the problem appers after u climb or when u climb or when ur on idle
after I climb after then climb anim plays
Want me to show u
A video
like after the climb the climb anim playing countinous
ok
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
** You are now Level 1! **
you mean I should make a custom idle animation?
yeah
if is need yes
ok ty for the help
np
Hi, this is caused due to clashing between two AnimationPriorities.
Set your climbing animation to a higher priority than the climbing animation,
you can do this in-code aswell.
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
Whats motor6d
I use Roblox studio built in animator
I put the hang anim on action and the climb action2 but now he has hands upwards
** You are now Level 2! **
Ooh fancy writing we got an expert here
You're setting it up via CFrames, and/or using the Motor6D directly, which then you should probably re-do here
I know I’m just joking
But either way, i hope those two can find out your issue with your script.
Alright I’ll try and if somethings wrong I’ll ask here