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

Why does this not do ANYTHING?

Asked by
Nidoxs 190
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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

Log in to vote
0
Answered by
Validark 1580 Snack Break Moderation Voter
9 years ago

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

Answer this question