I have a GUI where you can purchase tools and i have them save so i want to make it so that if theyre in ur backpack they say purchased but i have a script for them inside the textbutton but almost all of the time it doesn’t work
Edit: i think after you purchase an item and rejoin it doesnt work but if you purchase the item again and rejoin it does
local player = game.Players.LocalPlayer
if player.Backpack:FindFirstChild("Bucket") then
script.Parent.Text = ("Purchased")
script.Parent.LocalScript.Disabled = true
end
local player = game.Players.LocalPlayer
function check(child)
if ((child.ClassName ~= "Tool") or (child.Name ~= "Bucket")) then return end
script.Parent.Text = "Purchased"
script.Parent.LocalScript.Disabled = true
end
for _, v in next, player.Backpack:GetChildren() do
check(v)
end
player.Backpack.ChildAdded:Connect(check)