Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I fix this OnSelected Animated Tool?

Asked by
TofuBytes 500 Moderation Voter
10 years ago

I'm not on why it's not playing the animation when the user selects the tool. Please help?

local human = game.Players.LocalPlayer.Character:WaitForChild('Humanoid')
local danceanim = human:LoadAnimation(script.dance)
dancing = false

function onSelected()
if dancing == false then
dancing = true
danceanim:Play()
end
end

function unSelected()
if dancing == true then
dancing = false
danceanim:Stop()
end
end

script.Parent.Selected:connect(onSelected)
script.Parent.Deselected:connect(unSelected)

Answer this question