What do you want to achieve? Keep it simple and clear!
Basically I am making a script as when player clicks on a button the animation will start playing.
What is the issue? Include screenshots / videos if possible!
When I press the button the animation is not playing and theres no error in the output.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried looking for solutions via on the internet and the developer forum but I couldn’t find it.
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetId://3333499508"
local trackAnimation = nil
local playability = true
function PlayAnimation(animationSource)
if playability == true then
local plr = game.Players.LocalPlayer
trackAnimation = plr.Character.Humanoid:LoadAnimation (animation)
trackAnimation.KeyFrameReached:Connect(function()
end)
trackAnimation:Play()
end
end
script.Parent.MouseButton1Click:Connect(function(playability)
end)
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetId://3333499508"
local trackAnimation = nil
local playability = true
local plr = game.Players.LocalPlayer
function PlayAnimation(animationSource)
if playability == true then
trackAnimation = plr.Character.Humanoid.Animator:LoadAnimation(animation)
trackAnimation.KeyframeReached:Connect(function()
end)
trackAnimation:Play()
end
end
script.Parent.MouseButton1Click:Connect(PlayAnimation)
I got this error saying… 20:29:52.194 KeyFrameReached is not a valid member of AnimationTrack “Animation” - Client - LocalScript:13
20:29:52.195 Script ‘Players.adkawoawddwa.PlayerGui.ScreenGui.TextButton.LocalScript’, Line 13 - function PlayAnimation - Studio - LocalScript:13
Not sure if this is just a general error when copying over the code but there’s a gap in between LoadAnimation (animation), try LoadAnimation(animation)?
Change KeyFrameReached to KeyframeReached, the F isn’t capitalized, I didn’t know that was how the event was written so I left that capitalized
@BmxAlternative I already fixed that and I think it should work after the small change in event name now if it now errored that an AnimationTrack doesn’t have an event with that name
Anytime! I recommend you mark my post as the solution to help show others that this post is now fixed and immediately show them which post was it! If you have anymore issues don’t be afraid to make another post!
Mostly learned a long time ago from an old scripter called PeasFactory/PeasPod, whose videos are sorta outdated now. I’ve been scripting for a few years. Also it would’ve been better to message me instead of replying here again since it’s unrelated to this topic
Hello there kind sir… I was making an animation, stumbled across this post and then wrote this code and got an error in the output and the animation did not play. I am currently on a group game using a group animation ID. Any ideas as to why this doesn’t work?
Thanks.