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

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

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

3 comments

0

newtool.Parent

0

Capitalize the "p" in "parent".

0

wow dident see that thank you. :)

1 answer

✓ Accepted answer
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)

1 comment

0

lower case p is capital now. Might be a typo for 410200cold2

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