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

Dancing Emote Tool prints a error in the console, how do i fix this?

Asked by 5 years ago
Edited 5 years ago

Hello, this emote tool works fine but here's a problem, when i equip it then unequip it, it makes a error in the console

it says: dancer = index nil value or something

code below:

enabled = false

local Tool = script.Parent;

local dancer = nil

local player = game.Players.LocalPlayer function onActivated() if enabled == false then local humanoid = Tool.Parent:FindFirstChild("Humanoid") local torso = Tool.Parent:FindFirstChild("Torso") dancer = humanoid:LoadAnimation(Tool.dance) Tool.DanceObject.Value = dancer dancer:Play() Tool.dancepart.Position = player.Character.Head.Position Tool.dancepart.SongLoop:Play() enabled = true speed = player.Character.Humanoid.WalkSpeed player.Character.Humanoid.WalkSpeed = 0 repeat wait(1) Tool.dancepart.Position = player.Character.Head.Position until enabled == false else dancer:Stop() dancer:remove() Tool.dancepart.SongLoop:Stop() enabled = false player.Character.Humanoid.WalkSpeed = speed end end function onUnequipped() dancer:Stop() dancer:remove() Tool.dancepart.SongLoop:Stop() enabled = false player.Character.Humanoid.WalkSpeed = speed end Tool.Activated:connect(onActivated) Tool.Unequipped:connect(onUnequipped)

thank you.

0
sorry if the whole code didn't get into the box, it just happened for some reason Edentrix 2 — 5y
0
line? Creacoz 210 — 5y

Answer this question