Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game:GetService("Players").LocalPlayer
- local animator = player.Character:WaitForChild("Humanoid"):WaitForChild("Animator")
- local AvatarChoiceFrame = script.Parent.AvatarChoice
- local R15Choice = AvatarChoiceFrame.R15
- local R6Choice = AvatarChoiceFrame.R6
- local R15DancesButtons = script.Parent.R15Dances
- local R6DancesButtons = script.Parent.R6Dances
- local R15Close = R15DancesButtons:FindFirstChild("ChangeFrame")
- local R6Close = R6DancesButtons:FindFirstChild("ChangeFrame")
- local loadedAnim
- local loadedMusic
- local canChangeFrame = true
- local lastClickedButton
- for name, child in pairs (R15DancesButtons:GetChildren()) do
- child.MouseButton1Click:Connect(function()
- 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
- lastClickedButton = child
- loadedAnim = animator:LoadAnimation(child:FindFirstChild("DanceAnimation"))
- loadedAnim:Play()
- child:FindFirstChild("DanceMusic"):Play()
- loadedMusic = child:FindFirstChild("DanceMusic")
- game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, false)
- 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
- lastClickedButton = nil
- loadedAnim:Stop()
- loadedMusic:Stop()
- game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, true)
- 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
- loadedAnim:Stop()
- loadedMusic:Stop()
- lastClickedButton = child
- loadedAnim = animator:LoadAnimation(child:FindFirstChild("DanceAnimation"))
- loadedAnim:Play()
- child:FindFirstChild("DanceMusic"):Play()
- loadedMusic = child:FindFirstChild("DanceMusic")
- game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, false)
- end
- end)
- end
- for name, child in pairs (R6DancesButtons:GetChildren()) do
- child.MouseButton1Click:Connect(function()
- 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
- lastClickedButton = child
- loadedAnim = animator:LoadAnimation(child:FindFirstChild("DanceAnimation"))
- loadedAnim:Play()
- child:FindFirstChild("DanceMusic"):Play()
- loadedMusic = child:FindFirstChild("DanceMusic")
- game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, false)
- 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
- lastClickedButton = nil
- loadedAnim:Stop()
- loadedMusic:Stop()
- game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, true)
- 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
- loadedAnim:Stop()
- loadedMusic:Stop()
- lastClickedButton = child
- loadedAnim = animator:LoadAnimation(child:FindFirstChild("DanceAnimation"))
- loadedAnim:Play()
- child:FindFirstChild("DanceMusic"):Play()
- loadedMusic = child:FindFirstChild("DanceMusic")
- game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, false)
- game.StarterGui:SetCoreGui()
- end
- end)
- end
- R15Choice.MouseButton1Click:Connect(function()
- if canChangeFrame == true then
- canChangeFrame = false
- AvatarChoiceFrame.Visible = false
- R15DancesButtons.Visible = true
- canChangeFrame = true
- end
- end)
- R15Close.MouseButton1Click:Connect(function()
- if canChangeFrame == true then
- canChangeFrame = false
- AvatarChoiceFrame.Visible = true
- R15DancesButtons.Visible = false
- canChangeFrame = true
- end
- end)
- R6Choice.MouseButton1Click:Connect(function()
- if canChangeFrame == true then
- canChangeFrame = false
- AvatarChoiceFrame.Visible = false
- R6DancesButtons.Visible = true
- canChangeFrame = true
- end
- end)
- R6Close.MouseButton1Click:Connect(function()
- if canChangeFrame == true then
- canChangeFrame = false
- AvatarChoiceFrame.Visible = true
- R6DancesButtons.Visible = false
- canChangeFrame = true
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement