- What do you want to achieve?
Probably better source code of my Animation Handler, but I just want me animations to not break after reset.
- What is the issue?
When a player resets, they aren’t able to use the dancegui anymore.
The dancegui does have RESETONSPAWN to FALSE, because Im using TOPBARGUI.
- What solutions have you tried so far?
I tried my best, bust none resolved…
I tried putting this in my code -
while char.Parent == nil do
char.AncestryChanged:wait()
end
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
repeat wait() until humanoid:IsDescendantOf(game)
Here is the whole script -
-- Locals for the animations.
wait(1)
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
repeat wait() until humanoid:IsDescendantOf(game)
local frame=script.Parent
local frame2 = script.Parent.Parent.Page2
local anim
local Sound = script.Parent.Parent.Parent.Parent.Parent.Sound
-- Function for playing the animations.
function playanim(id)
if char~=nil and humanoid ~= nil then
local id="rbxassetid://"..tostring(id)
local oldanim=char:FindFirstChild("LocalAnimation")
if anim~=nil then
anim:Stop()
end
if oldanim~=nil then
if oldanim.AnimationId==id then
oldanim:Destroy()
return
end
oldanim:Destroy()
end
local animation=Instance.new("Animation",char)
animation.Name="LocalAnimation"
animation.AnimationId=id
anim=humanoid:LoadAnimation(animation)
anim:Play()
end
end
-- This is where you add more of your buttons and dances.. Just copy and paste. Make sure to change the b's.
-- PAGE 1
local b1=frame.Button1
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) Sound:Play() end)
local b2=frame.Button2
b2.MouseButton1Down:connect(function() playanim(b2.AnimID.Value) Sound:Play() end)
local b3=frame.Button3
b3.MouseButton1Down:connect(function() playanim(b3.AnimID.Value) Sound:Play() end)
local b4=frame.Button4
b4.MouseButton1Down:connect(function() playanim(b4.AnimID.Value) Sound:Play() end)
local b5=frame.Button5
b5.MouseButton1Down:connect(function() playanim(b5.AnimID.Value) Sound:Play() end)
local b6=frame.Button6
b6.MouseButton1Down:connect(function() playanim(b6.AnimID.Value) Sound:Play() end)
local b7=frame.Button7
b7.MouseButton1Down:connect(function() playanim(b7.AnimID.Value) Sound:Play() end)
-- PAGE 2
local b1=frame2.Button1
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) Sound:Play() end)
local b2=frame2.Button2
b2.MouseButton1Down:connect(function() playanim(b2.AnimID.Value) Sound:Play() end)
local b3=frame2.Button3
b3.MouseButton1Down:connect(function() playanim(b3.AnimID.Value) Sound:Play() end)
local b4=frame2.Button4
b4.MouseButton1Down:connect(function() playanim(b4.AnimID.Value) Sound:Play() end)
local b5=frame2.Button5
b5.MouseButton1Down:connect(function() playanim(b5.AnimID.Value) Sound:Play() end)
local b6=frame2.Button6
b6.MouseButton1Down:connect(function() playanim(b6.AnimID.Value) Sound:Play() end)
local b7=frame2.Button7
b7.MouseButton1Down:connect(function() playanim(b7.AnimID.Value) Sound:Play() end)
Any ideas?