#Animation doesn't start

1 messages · Page 1 of 1 (latest)

warm rampart
#

Yes ik its gpt trust me ive gone through this code as best as I can Im still a beginner tho

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")

-- Wait for the local player
local player = Players.LocalPlayer

-- Wait for the character to exist
local character = player.Character or player.CharacterAdded:Wait()

-- Wait for Humanoid to exist
local humanoid = character:WaitForChild("Humanoid")

-- Ensure Animator exists
local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator then
    animator = Instance.new("Animator")
    animator.Parent = humanoid  -- MUST be under Humanoid
end
local anim = ReplicatedStorage:WaitForChild("Test")


-- Optional: Stop other R6 animations to avoid conflicts
local function stopOtherAnimations()
    for _, a in pairs(humanoid:GetPlayingAnimationTracks()) do
        a:Stop()
    end
end
-- Key press detection
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if input.KeyCode == Enum.KeyCode.E then
        print("E pressed! Playing punch animation.")
        stopOtherAnimations()  -- stop conflicting animations
        -- Load the animation (make sure this Animation object exists in ReplicatedStorage)

        local track = animator:LoadAnimation(anim)
        track.Priority = Enum.AnimationPriority.Action4
        track:Play()           -- play punch animation

    end
end)

everythign else works correctly, do I need to stop other animations before playing my own?

dusky turret
#

it might be cause it’s using humanoid:getplayinganimationtracks

#

switch humanoid to animator

#

@warm rampart

warm rampart
#

?

dusky turret
#

read what i said

#

and do it

warm rampart
#

wait I'm confused

#

Humanoid is parent of animator

#

using animator to start track

dusky turret
#

just switch the humanoid variable to animator variable

warm rampart
#

ok

dusky turret
#

in the for loop underneath the function

#

Yes ik its gpt trust me ive gone through this code as best as I can Im still a beginner tho

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")

-- Wait for the local player
local player = Players.LocalPlayer

-- Wait for the character to exist
local character = player.Character or player.CharacterAdded:Wait()

-- Wait for Humanoid to exist
local humanoid = character:WaitForChild("Humanoid")

-- Ensure Animator exists
local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator then
    animator = Instance.new("Animator")
    animator.Parent = humanoid  -- MUST be under Humanoid
end
local anim = ReplicatedStorage:WaitForChild("Test")


-- Optional: Stop other R6 animations to avoid conflicts
local function stopOtherAnimations()
    for _, a in pairs(animator:GetPlayingAnimationTracks()) do
        a:Stop()
    end
end
-- Key press detection
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if input.KeyCode == Enum.KeyCode.E then
        print("E pressed! Playing punch animation.")
        stopOtherAnimations()  -- stop conflicting animations
        -- Load the animation (make sure this Animation object exists in ReplicatedStorage)

        local track = animator:LoadAnimation(anim)
        track.Priority = Enum.AnimationPriority.Action4
        track:Play()           -- play punch animation

    end
end)

everythign else works correctly, do I need to stop other animations before playing my own?

#

should be it

warm rampart
#

wait what did you change

dusky turret
#

just copy and paste what i sent

warm rampart
#

no difference

dusky turret
#

boi

warm rampart
#

animation doesnt play

dusky turret
#

any errors?

warm rampart
#

no

dusky turret
#

is it outputting the prints

warm rampart
#

yes

dusky turret
#

do you own the animation?

warm rampart
#

Yes but the animation isnt the issue

#

as ive tested with

quasi latchBOT
#

studio** You are now Level 4! **studio

warm rampart
#

default animations

dusky turret
#

remove the line that sets the track priority

warm rampart
#

kk

#

same result

dusky turret
#

boiiii

#

print the track out

warm rampart
#

kk

#

its 2

dusky turret
#

what

warm rampart
#

???

#

o u mean the track

#

ok

dusky turret
#

yes

warm rampart
#

printing track just gives the animation name

#

which is Test

dusky turret
#

did you ask chat gpt

warm rampart
#

chatgpt doesnt know whats goin on

dusky turret
#

fuck him go ask gemini

#

then grok

warm rampart
#

idt ai getting me out of this one

warm rampart
#

can someone help?

fleet island
#

@warm rampart

#

This is ez

warm rampart
#

ok

fleet island
#

but is it r6 rig or r15

warm rampart
#

r6

fleet island
#

ok bet

#

Are u tryna make it

#

So when u join game

warm rampart
#

play on keypress

fleet island
#

The rig laysa imayion

warm rampart
#

keypress

#

thats working rn

#

jsut the animation doesnt play

fleet island
#

wdym keypress

#

u want it so when u press a butto nthe anim palys

#

@warm rampart

#

bro

#

Explain this better

#

too confusing

warm rampart
#

yea

#

when e is pressed

#

play animation

#

its in the code

fleet island
#

oh ok

#

@warm rampart

#

Make a rig

#

Add proximity prompt to it

warm rampart
#

why proximity prompt?

#

I'm trying to make the player avatar play the animation

#

the animation works fine when testing on an r6 rig

#

but does not play on player avatar/humanoid

fleet island
#

oh

warm rampart
#

so uhhh

#

whats the issue

#

dyk

warm rampart
#

ok soo

#
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

-- Ensure that the character's humanoid contains an "Animator" object
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

-- Create a new "Animation" instance and assign an animation asset ID
local kickAnimation = Instance.new("Animation")
kickAnimation.AnimationId = "rbxassetid://110884560312128"

-- Load the animation onto the animator
local kickAnimationTrack = animator:LoadAnimation(kickAnimation)

-- If a named event was defined for the animation, connect it to "GetMarkerReachedSignal()"
kickAnimationTrack:GetMarkerReachedSignal("KickEnd"):Connect(function(paramString)
    print(paramString)
end)

task.wait(4)

-- Play the animation track
kickAnimationTrack.Priority= Enum.AnimationPriority.Action4
kickAnimationTrack:Play()
#

this works with default animations but not mine

#

however the animation i made is working fine on the rig

#

just not an actual player

#

Im using the blender animations plugin to import

long hazel
#

when you press e what happends?

#

does it print the e key was pressed or nah

#

oh wait now i see the new script

desert cypress
#

@fleet island

#

stop it

long hazel
#

you woke up and choose the genocide route

warm rampart
long hazel
#

taling bout' dark

#

when you execute it what it says?

#

i've never used or when assigning a tag

#

so im quite lost there

warm rampart
#

it doesnt say anything

#

the animation just doesnt play

#

idk why

#

the script works with default animations tho

#

so its an issue witht eh animation i made

#

except it works fine on a rig

#

so idk

#

im using a plugin to import

fleet island
#

Dumb as

#

i did nothing

desert cypress
#

i can teach you

fleet island
#

wdym

#

Whats s2

#

Superior

#

???

desert cypress
#

scripter 2

fleet island
#

Ohhh

#

How can u teach me?

#

@desert cypress

desert cypress
fleet island
#

ok

warm rampart
#

anyone know whats wrong?

desert cypress
desert cypress
#

@warm rampart what you need help with

warm rampart
#

getting the animation working

#

read what i sent

desert cypress
#

show me the script

warm rampart
#

local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

-- Ensure that the character's humanoid contains an "Animator" object
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

-- Create a new "Animation" instance and assign an animation asset ID
local kickAnimation = Instance.new("Animation")
kickAnimation.AnimationId = "rbxassetid://110884560312128"

-- Load the animation onto the animator
local kickAnimationTrack = animator:LoadAnimation(kickAnimation)

-- If a named event was defined for the animation, connect it to "GetMarkerReachedSignal()"
kickAnimationTrack:GetMarkerReachedSignal("KickEnd"):Connect(function(paramString)
print(paramString)
end)

task.wait(4)

-- Play the animation track
kickAnimationTrack.Priority= Enum.AnimationPriority.Action4
kickAnimationTrack:Play()

#
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

-- Ensure that the character's humanoid contains an "Animator" object
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

-- Create a new "Animation" instance and assign an animation asset ID
local kickAnimation = Instance.new("Animation")
kickAnimation.AnimationId = "rbxassetid://110884560312128"

-- Load the animation onto the animator
local kickAnimationTrack = animator:LoadAnimation(kickAnimation)

-- If a named event was defined for the animation, connect it to "GetMarkerReachedSignal()"
kickAnimationTrack:GetMarkerReachedSignal("KickEnd"):Connect(function(paramString)
    print(paramString)
end)

task.wait(4)

-- Play the animation track
kickAnimationTrack.Priority= Enum.AnimationPriority.Action4
kickAnimationTrack:Play()
#

issue isnt the script

#

well

#

idk atp

#

script works with roblox default animations; custom animation works perfectly on r6 rig preview(blender-roblox plugin) but custom animation doesnt work on avatar

#

@desert cypress

undone sun
#

if you ever use this again

#

cuz the humanoid one is deprecated i believe

warm rampart
#

ok

#

but do you see an issue

desert cypress
#

so does it print

warm rampart
#

yeah using roblox default aniamtions works fine

desert cypress
#

wdym

#

it should be connected to ur own animation event

warm rampart
desert cypress
#

wtf

warm rampart
#

if i change the script to play another roblox animation

#

then it works

#

it just that my animation doesnt

#

i made it in blender

undone sun
warm rampart
#

theres a plugin in blender that exports it to roblox

#

so i do that

#

gives me a preview on rig which works fine

#

lemme get a recording one sec

desert cypress
#

do u even have the event

#

in the animation

#

...

warm rampart
#

so ive uploaded the animation as an assetid

#

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

-- Ensure that the character's humanoid contains an "Animator" object
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

-- Create a new "Animation" instance and assign an animation asset ID
local kickAnimation = Instance.new("Animation")
kickAnimation.AnimationId = "rbxassetid://110884560312128"

-- Load the animation onto the animator
local kickAnimationTrack = animator:LoadAnimation(kickAnimation)

-- If a named event was defined for the animation, connect it to "GetMarkerReachedSignal()"
kickAnimationTrack:GetMarkerReachedSignal("KickEnd"):Connect(function(paramString)
    print(paramString)
end)

task.wait(4)

-- Play the animation track
kickAnimationTrack.Priority= Enum.AnimationPriority.Action4
kickAnimationTrack:Play()
#

you can see the animation working on an r6 rig

#

@desert cypress

desert cypress
#

budd

#

y

#

u need to make the event urself

#

in roblox

#

or its never gonna work

warm rampart
#

if you use other roblox animations the script works

#

so why isnt the custom aniamtion not working

desert cypress
#

ause

#

cause i said so

#

above

warm rampart
#

uhhh

#

ok so how would i make the event

#

it looks like i'm already callling kickAnimationTrack:Play()

civic sigil
#

ok so whats the issue @warm rampart

desert cypress
#

@civic sigil if u can sovle this ur s3

#

and u will open ur butt for @fluid oasis

civic sigil
#

wut

#

igh bet

desert cypress
#

LMFAO LMFAO

civic sigil
#

sorry im high asf rn

desert cypress
#

what you smoking

fluid oasis
civic sigil
#

thc

#

disposable

#

feels p good

desert cypress
#

thats great

#

thats amazing

#

so u code high

desert cypress
fluid oasis
#

yeah

warm rampart
#

shits fried

warm rampart
#

kk

desert cypress
#

@civic sigil im high

civic sigil
#

ohhh this shi

#

i got an idea

civic sigil
desert cypress
civic sigil
#
local function stopOtherAnimations()
    for _, a in pairs(humanoid:GetPlayingAnimationTracks()) do
        task.spawn(function()
repeat
a:Stop()
task.wait(.03)
until not a.IsPlaying
end)
    end
end
#

my thought on this is due to roblox tending to be fucky w anims

#

at times

#

.03 in task.wait since it isnt the biggest priority

#

which means that doing nil args would waste things

desert cypress
#

ur so high

warm rampart
quasi latchBOT
#

studio** You are now Level 6! **studio

warm rampart
#

idk whats wrong with mine

civic sigil
warm rampart
#

customa animation works on rig tho

#

@civic sigil

desert cypress
#

i want u to start 6 7 67 67 67

warm rampart
#

what

civic sigil
warm rampart
#

r6 rig works

#

r6 player doesnt

#

animation is r6

#

made in blender

civic sigil
#

hmm ok

#

gimme a sec

warm rampart
#

imported to roblox

#

?

civic sigil
#

my fuhhh im sped asf

#
local function stopOtherAnimations()
    for _, a in pairs(animator:GetPlayingAnimationTracks()) do
        a:Stop()

    end
end
#

did we try this first

#

@warm rampart

warm rampart
#

but it doesnt make a difference

#

im setting the aniamtion priority to action4

civic sigil
#

wait....

#

OH SHI I REMEMBER THIS

#
repeat
        track:Play()
        
        task.wait()
    until track.IsPlaying
warm rampart
#

nope

#

doesnt work

#

anything wrong with the animation itself?

#

try importing this and testing it on ur end

civic sigil
#

gimme a sec scripting some rn

warm rampart
#

@civic sigil

#

any ideas

#

shis cooked

civic sigil
#

oh fuhhhh i was busy w some

#

@warm rampart ok send me current script

#

@warm rampart ey

#

im tryna make a fix

warm rampart
#

kk

warm rampart
# civic sigil <@658764004688134185> ey

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

-- Ensure that the character's humanoid contains an "Animator" object
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

-- Create a new "Animation" instance and assign an animation asset ID
local kickAnimation = Instance.new("Animation")
kickAnimation.AnimationId = "rbxassetid://110884560312128"

-- Load the animation onto the animator
local kickAnimationTrack = animator:LoadAnimation(kickAnimation)

-- If a named event was defined for the animation, connect it to "GetMarkerReachedSignal()"
kickAnimationTrack:GetMarkerReachedSignal("KickEnd"):Connect(function(paramString)
    print(paramString)
end)
local humanoidRootPart = character.HumanoidRootPart
humanoidRootPart.Anchored = false
task.wait(4)

-- Play the animation track
kickAnimationTrack.Priority= Enum.AnimationPriority.Action4
kickAnimationTrack:Play()
task.wait(4)

civic sigil
#

igh on walk rn

warm rampart
#

?

warm rampart
#

@civic sigil u got it

civic sigil
#

nah i jus got home

#

works fine for me @warm rampart

#

local Players = game:GetService("Players")
local UIService = game:GetService("UserInputService")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

-- Ensure that the character's humanoid contains an "Animator" object
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

-- Create a new "Animation" instance and assign an animation asset ID
local kickAnimation = Instance.new("Animation")
kickAnimation.AnimationId = "rbxassetid://100942824422971"

-- Load the animation onto the animator
local kickAnimationTrack = animator:LoadAnimation(kickAnimation)

-- If a named event was defined for the animation, connect it to "GetMarkerReachedSignal()"
kickAnimationTrack:GetMarkerReachedSignal("KickEnd"):Connect(function(paramString)
print(paramString)
end)
local humanoidRootPart = character.HumanoidRootPart
humanoidRootPart.Anchored = false
UIService.InputBegan:Connect(function(Input,Focused)
if Focused then return end
if Input.KeyCode == Enum.KeyCode.One then
kickAnimationTrack.Priority= Enum.AnimationPriority.Action4
kickAnimationTrack:Play()
end
end) i used this shi

#

works fine for me

warm rampart
#

yea its an issue witht he animation i made

#

its incompatible or smth

#

question is why the animation works fine on roblox rig

civic sigil
#

like

#

your own rig

warm rampart
civic sigil
#

uhh i uploaded the anim

#

and it played

#

on r6 rig

warm rampart
#

Huh

#

The anim I sent?

#

Yeah that’s the thing

#

It works on the rig

#

But not a player

#

@civic sigil

civic sigil
#

i did do it on a player

#

it worked bru

warm rampart
civic sigil
#

ye

#

prolly some other shi in your game

warm rampart
#

damn what

#

where did you put your script?

#

cuz this is legit the onlyt hing in my game

wicked mortar
#

@warm rampart is ur game under a group

#

And you uploaded animation under yourself

#

?

#

Sounds to ME like you might not have permission to use the animation

#

That or it's an issue with your anim

#

And if it's an issue with ur anim I can't help cuz I'm not an animator

#

Or maybe youre trying to play r15 anim on r6 or vice versa

#

Try adding this line to see if something is stopping it

#

Lemme go on PC rw

#
kickAnimationTrack.Stopped:Connect(function()
    print("Stopped")
end)

kickAnimationTrack.AncestryChanged:Connect(function() 
    print("hm")
end)```
#

@warm rampart

#

add this

warm rampart
#

yeah ok

#

everythings r6

#

game is only under me

wicked mortar
#

?

warm rampart
#

yes

#

here maybe try importing the anim urself and see if it works for u

#

heres the raw blender data\

wicked mortar
#

Im not animator

#

u got that

warm rampart
#

....

#

well

#

idk if its the animation or the script

#

the animation works on rig preview

#

but not on the player

#

nothing stopping it

#

action4 too

long hazel
#

ts so easy

#

just play the animation