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

Crafting script doesn't work? Me and my friend tried fixing it, but we can't find out what's wrong.

So, me and my friend were trying to make a crafting script using "Number Values." We looked at the code, but it showed no errors. We can't figure out what's wrong, please help!

local stat1 = "Wood"
local stat1value = 1 
local stat2 = "Vines" 
local stat2value = 1
local final = game.ServerStorage:WaitForChild("Wood Sword")

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.StarterGear
		end
	end)	
end)

`

1 comment

0

Forgot to add "It didn't work."

2 answers

line 14: StarterGear is not a member of plr. In the plr StarterGear is called Backpack.

so, line 14: tool.Parent = plr.Backpack

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