I think the error is on line 2? How do I fix this?
Workspace.Model.Sushi.Script:2: attempt to index local 'player' (a nil value)
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, player)
repeat wait() until player.Character ~= nil
local hum = player.Character:WaitForChild("Humanoid")
local animation = script.ChefAnimation
local AnimTrack = hum:LoadAnimation(animation)
local player = game.Players:GetPlayerFromCharacter(click.Parent)
local char = player.Character
if debounce == false then
debounce = true
AnimTrack:Play()
wait(2)
local a = game.ServerStorage.SpringRoll:Clone()
a.Parent = player.Backpack
wait(10)
debounce = false
end
end
script.Parent.MouseButton1Down:connect(onClick)

3 comments
Server Script or Local Script? You need to provide more information with your posts other than just a error. We sometimes need to know what type of script you're using. Also, you overwrote the player value in the onClick function by placing them in the parenthesis, it will be considered a nil value.
It is a Local script and how do I fix this then?
This is in a server script. Not a local script. Put it in a local script and it will work. And as M39 said, you've overwritten the player variable inside the function.