It should play an animation and give you a tool but it doesn't do anything and does not give out an output? How do I fix this script? And is there any problems?
local player = game.Players.LocalPlayer repeat wait() until player.Character ~= nil local hum = player.Character:WaitForChild("Humanoid") local animation = script.ChefAnimation local AnimTrack = hum:LoadAnimation(animation) debounce = false function onClick(click) if debounce == false then if player.Backpack:findFirstChild("SpringRoll")then player.Backpack.SpringRoll:Destroy() AnimTrack:Play() wait(2.8) local b = script["Cha GiĆ² Spring Rolls"]:Clone() b.Parent = player.Backpack end end end wait(5) debounce = false script.Parent.ClickDetector.MouseClick:connect(onClick)
When scripts do nothing, please resort to putting print()
functions on every line. This way you can see how far the script gets.
This might solve your problem:
repeat wait() until game.Players.LocalPlayer; local player = game.Players.LocalPlayer local Character = player:WaitForChild("Character") local hum = Character:WaitForChild("Humanoid")