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

how do i fix buy an item and put it in players backpack?

Asked by 6 years ago
Edited 6 years ago
script.Parent.MouseButton1Click:connect(function()
    if currency.Value >=100 and not player.Backpack:FindFirstChild('GravityCoil')or player.Character:FindFirstChild('GravityCoil')then

        currency.Value = currency.Value - amount
        local newtool = tool:Clone()
        newtool.parent = player.Backpack -- this line is were it says the error is
    else
        script.Parent.Text = "Purchase Failed, Try again later"
        wait(0.5)
        script.Parent.Text = indextext
    end
end)

the error it gives in out put is this 22:13:59.127 - parent is not a valid member of Tool if you see a mistake please tell me.

when i click on the button it takes the money but doesn't give me the gravitycoil. the gravitycoil is in serverstorage

0
newtool.Parent rens321 1 — 6y
0
Capitalize the "p" in "parent". Le_Teapots 913 — 6y
0
wow dident see that thank you. :) 410200cold2 4 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
script.Parent.MouseButton1Click:Connect(function()
    if currency.Value >=100 and not player.Backpack:FindFirstChild('GravityCoil') or player.Character:FindFirstChild('GravityCoil') then

        currency.Value = currency.Value - amount
        local newtool = tool:Clone()
        newtool.Parent = player.Backpack
    else
        script.Parent.Text = "Purchase Failed, Try again later"
        wait(0.5)
        script.Parent.Text = indextext
    end
end)
0
lower case p is capital now. Might be a typo for 410200cold2 ILikeTofuuJoe 1 — 6y
Ad

Answer this question