Advertisement
Kezoto

Untitled

Apr 14th, 2021
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. local player = game:GetService("Players").LocalPlayer
  2. local animator = player.Character:WaitForChild("Humanoid"):WaitForChild("Animator")
  3. local AvatarChoiceFrame = script.Parent.AvatarChoice
  4. local R15Choice = AvatarChoiceFrame.R15
  5. local R6Choice = AvatarChoiceFrame.R6
  6. local R15DancesButtons = script.Parent.R15Dances
  7. local R6DancesButtons = script.Parent.R6Dances
  8. local R15Close = R15DancesButtons:FindFirstChild("ChangeFrame")
  9. local R6Close = R6DancesButtons:FindFirstChild("ChangeFrame")
  10. local loadedAnim
  11. local loadedMusic
  12. local canChangeFrame = true
  13. local lastClickedButton
  14.  
  15. for name, child in pairs (R15DancesButtons:GetChildren()) do
  16. child.MouseButton1Click:Connect(function()
  17. if child.Name:find("Dance") and child:FindFirstChild("DanceAnimation") and child:FindFirstChild("DanceMusic") and player.Character:WaitForChild("Humanoid").RigType == Enum.HumanoidRigType.R15 and lastClickedButton == nil then
  18. lastClickedButton = child
  19. loadedAnim = animator:LoadAnimation(child:FindFirstChild("DanceAnimation"))
  20. loadedAnim:Play()
  21. child:FindFirstChild("DanceMusic"):Play()
  22. loadedMusic = child:FindFirstChild("DanceMusic")
  23. game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, false)
  24. elseif child.Name:find("Dance") and child:FindFirstChild("DanceAnimation") and child:FindFirstChild("DanceMusic") and player.Character:WaitForChild("Humanoid").RigType == Enum.HumanoidRigType.R15 and lastClickedButton == child then
  25. lastClickedButton = nil
  26. loadedAnim:Stop()
  27. loadedMusic:Stop()
  28. game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, true)
  29. elseif child.Name:find("Dance") and child:FindFirstChild("DanceAnimation") and child:FindFirstChild("DanceMusic") and player.Character:WaitForChild("Humanoid").RigType == Enum.HumanoidRigType.R15 and lastClickedButton ~= nil and lastClickedButton ~= child then
  30. loadedAnim:Stop()
  31. loadedMusic:Stop()
  32. lastClickedButton = child
  33. loadedAnim = animator:LoadAnimation(child:FindFirstChild("DanceAnimation"))
  34. loadedAnim:Play()
  35. child:FindFirstChild("DanceMusic"):Play()
  36. loadedMusic = child:FindFirstChild("DanceMusic")
  37. game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, false)
  38. end
  39. end)
  40. end
  41.  
  42. for name, child in pairs (R6DancesButtons:GetChildren()) do
  43. child.MouseButton1Click:Connect(function()
  44. if child.Name:find("Dance") and child:FindFirstChild("DanceAnimation") and child:FindFirstChild("DanceMusic") and player.Character:WaitForChild("Humanoid").RigType == Enum.HumanoidRigType.R6 and lastClickedButton == nil then
  45. lastClickedButton = child
  46. loadedAnim = animator:LoadAnimation(child:FindFirstChild("DanceAnimation"))
  47. loadedAnim:Play()
  48. child:FindFirstChild("DanceMusic"):Play()
  49. loadedMusic = child:FindFirstChild("DanceMusic")
  50. game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, false)
  51. elseif child.Name:find("Dance") and child:FindFirstChild("DanceAnimation") and child:FindFirstChild("DanceMusic") and player.Character:WaitForChild("Humanoid").RigType == Enum.HumanoidRigType.R6 and lastClickedButton == child then
  52. lastClickedButton = nil
  53. loadedAnim:Stop()
  54. loadedMusic:Stop()
  55. game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, true)
  56. elseif child.Name:find("Dance") and child:FindFirstChild("DanceAnimation") and child:FindFirstChild("DanceMusic") and player.Character:WaitForChild("Humanoid").RigType == Enum.HumanoidRigType.R6 and lastClickedButton ~= nil and lastClickedButton ~= child then
  57. loadedAnim:Stop()
  58. loadedMusic:Stop()
  59. lastClickedButton = child
  60. loadedAnim = animator:LoadAnimation(child:FindFirstChild("DanceAnimation"))
  61. loadedAnim:Play()
  62. child:FindFirstChild("DanceMusic"):Play()
  63. loadedMusic = child:FindFirstChild("DanceMusic")
  64. game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, false)
  65. game.StarterGui:SetCoreGui()
  66. end
  67. end)
  68. end
  69.  
  70.  
  71.  
  72.  
  73. R15Choice.MouseButton1Click:Connect(function()
  74. if canChangeFrame == true then
  75. canChangeFrame = false
  76. AvatarChoiceFrame.Visible = false
  77. R15DancesButtons.Visible = true
  78. canChangeFrame = true
  79. end
  80. end)
  81.  
  82. R15Close.MouseButton1Click:Connect(function()
  83. if canChangeFrame == true then
  84. canChangeFrame = false
  85. AvatarChoiceFrame.Visible = true
  86. R15DancesButtons.Visible = false
  87. canChangeFrame = true
  88. end
  89. end)
  90.  
  91.  
  92.  
  93. R6Choice.MouseButton1Click:Connect(function()
  94. if canChangeFrame == true then
  95. canChangeFrame = false
  96. AvatarChoiceFrame.Visible = false
  97. R6DancesButtons.Visible = true
  98. canChangeFrame = true
  99. end
  100. end)
  101.  
  102. R6Close.MouseButton1Click:Connect(function()
  103. if canChangeFrame == true then
  104. canChangeFrame = false
  105. AvatarChoiceFrame.Visible = true
  106. R6DancesButtons.Visible = false
  107. canChangeFrame = true
  108. end
  109. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement