So I watched the TheDevKing's video on how to play animations and I can't seem to get it working.
(Quick note that I am following the script that TheDevKing exactly, time that the script is finished here: https://youtu.be/tnvlWtuCqUw?t=1143)
To make a character play an animation:
This only works in local scripts (i think, im kind of new).
Inside a TextButton, inside a GUI in starterGUI:
local Anim = Instance.new("Animation") -- create the animation. Anim.AnimationId = "http://www.roblox.com/asset/?id=5517298285" -- Set the Animation's id. Anim.Parent = script -- Parent the animation to the script. local Character = game.Players.LocalPlayer.Character -- Get Character. local AnimLoaded = Character:WaitForChild("Humanoid"):LoadAnimation(Anim) -- Load Animation,we are going to need this for the character to play the anim. script.Parent.Activated:connect(function() -- Player clicked the UI/GUI. AnimLoaded:Play() -- Play the animation. wait(3) AnimLoaded:Stop() -- Stop Anim. end)
That should work. BTW dont use that animation, i made it and its really bad.
Closed as off-topic by JesseSong
This question has been closed by our community as being off-topic from ROBLOX Lua Scripting.
Why was this question closed?