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

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

Asked by 4 years ago

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)

`

0
Forgot to add "It didn't work." 1Bunneh 0 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

Try put the tool in the player backpack also

0
Will try. 1Bunneh 0 — 4y
0
didn't work 1Bunneh 0 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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

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

Answer this question