Me and my friend made a crafting gui, it didn't work, we've tried fixing it. What's wrong?
local stat1 = "Wood" -- change nil to 1st stat
local stat1value = 1 -- how many for stat to work
local stat2 = "Vines" -- change nil to 2nd stat
local stat2value = 1 -- how many for stat to work
local final = game.ServerStorage:WaitForChild("Wood Sword") -- in the () put the tool with " around both ends like this: "hi"
game.Players.PlayerAdded:Connect(function(plr)
local statfolder = plr:WaitForChild("stats")
script.Parent.MouseButton1Down:Connect(function()
if statfolder:FindFirstChild(stat1).Value >= stat1value and statfolder:FindFirstChild(stat2).Value >= stat2value then
statfolder:FindFirstChild(stat1).Value = statfolder:FindFirstChild(stat1).Value - stat1value
statfolder:FindFirstChild(stat2).Value = statfolder:FindFirstChild(stat2).Value - stat2value
local tool = final:Clone()
tool.Parent = plr.Backpack
end
end)
end)
