I'm making a script, and in the output, the only error is that I haven't defined the player, its for a script to equip a tool in a GUI, for a inventory system I made, but the function is : "script.Parent.MouseButton1Click:connect(function(player)", but I need to define player to define the pickaxe. So how would I define the player, here is the code :
local pickaxe = player.Backpack:FindFirstChild("Pickaxe")
--------------------------- "player" definition needed here
script.Parent.MouseButton1Click:connect(function(player)
local pickaxe = player.Backpack:findFirstChild("Pickaxe")
if script.Parent.Text == "Unequip" then
pickaxe.Parent = game.ServerStorage
script.Parent.Text = "Equip"
else
pickaxe:Clone().Parent = player.Backpack
script.Parent.Text = "Unequip"
end
end)

2 comments
But what do I do if it ISN'T a local script. I even stated in my question that its a normal "script".
By the looks of it the script is under PlayerGui/StartGui just put the code in a localscript and use that