Er1x_Official

How To Make an Animation Player Gui Roblox -- Local Script

Jun 17th, 2021
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. local par = script.Parent -- parent
  2. local player = game.Players.LocalPlayer -- local player
  3. local animations = par.Animations -- animation folder
  4.  
  5. local function anim1() -- function
  6.     local char = player.Character -- players character
  7.     local animator = char.Humanoid.Animator -- animator inside the players character
  8.     local animation = animations.A1 -- animation track
  9.     animator:LoadAnimation(animation):Play() -- load and play the animation
  10. end
  11.  
  12. local function anim2()
  13.     local char = player.Character
  14.     local animator = char.Humanoid.Animator
  15.     local animation = animations.A2
  16.     animator:LoadAnimation(animation):Play()
  17. end
  18.  
  19. local function anim3()
  20.     local char = player.Character
  21.     local animator = char.Humanoid.Animator
  22.     local animation = animations.A3
  23.     animator:LoadAnimation(animation):Play()
  24. end
  25.  
  26. par.Animation1.MouseButton1Click:Connect(anim1) -- connect the function ( play the animation
  27. par.Animation2.MouseButton1Click:Connect(anim2)
  28. par.Animation3.MouseButton1Click:Connect(anim3)
Advertisement
Add Comment
Please, Sign In to add comment