Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does this not do ANYTHING?

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)

1 answer

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")

This discussion is preserved as it was. New answers, comments, and votes are closed.