Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how can i delete the t pose between animations in roblox?

Asked by 2 years ago

Hello, im currently making a npc that is sitting and walks somewhere when the player touches the part. My problem is that i want those one animation to stop and the other to play immediately but instead of that it stops the idle animation and then you get a roblox t pose and after that the second animation plays.

local Part = script.Parent
local NPC = script.Parent.Skeleton
local Animation = script.Parent.Guyscare
local Idle = script.Parent.IdleAnim

local animat = NPC.Humanoid:LoadAnimation(Idle)




animat:Play()

Part.Touched:Connect(function(Hit)
    local Anim = NPC.Humanoid:LoadAnimation(Animation)

local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
    if Player then


        Anim:Play(1)
        animat:Stop(0)
        Anim.Stopped:Wait()
        script.Parent:Destroy()
    end
end)

1 answer

Log in to vote
0
Answered by 2 years ago

Found the Issue, your using a outdated version of Humanoid:LoadAnimation

You need to load the animation using a Animator which more Information can be found here: https://developer.roblox.com/en-us/api-reference/function/Animator/LoadAnimation

Anyway to fix It simply add a Animator Inside of the NPC humanoid, then a animation Inside of It, then use this script: (If It doesn't work try using the other one and simply modify It)

local Part = script.Parent
local NPC = script.Parent.Skeleton
local Animator = NPC.Humanoid.Animator
local Animation = script.Parent.Guyscare
local Idle = script.Parent.IdleAnim

local animat = NPC.Humanoid:FindFirstChild("Animator"):LoadAnimation(Idle)




animat:Play()

Part.Touched:Connect(function(Hit)
    local Anim = NPC.Humanoid:FindFirstChild("Animator"):LoadAnimation(Animation)

    local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
    if Player then


        Anim:Play(1)
        animat:Stop(0)
        Anim.Stopped:Wait()
        script.Parent:Destroy()
    end
end)

Other script:

local NPC = script.Parent

while wait() do
    local AnimationTrack = NPC.Humanoid:FindFirstChild("Animator"):LoadAnimation(NPC.Humanoid.Animator.Animation)
    AnimationTrack:Play()
end
0
Thank you very much! I'll try this 123marooxd123 13 — 2y
Ad

Answer this question