When clicked, the button gives a tool and prints a message. The problem is the message doesnt go away so when the shop gui is closed, you can not open it again (part on touched open gui). I think it is the "hint" s fault because it also doesnt say anything. if someone could get rid of the hint (make it say something and close), that would be great. (i suck at scripting)
local items = script.Parent.Frame:GetChildren() for i = 1, #items do function buy() Gold = script.Parent.Parent.Parent.Parent.leaderstats:FindFirstChild(items[i].Currency.Value) h = Instance.new("Hint") h.Parent = script.Parent.Parent.Parent if Gold.Value >= items[i].Cost.Value then Gold.Value = Gold.Value - items[i].Cost.Value toolca = game.Lighting:FindFirstChild(items[i].ItemName.Value):Clone() toolcb = game.Lighting:FindFirstChild(items[i].ItemName.Value):Clone() toolca.Parent = script.Parent.Parent.Parent.Parent.Backpack toolcb.Parent = script.Parent.Parent.Parent.Parent.StarterGear end end items[i].BuyButton.MouseButton1Click:connect(buy) end
A simple answer to your question would be to use the wait(x)
function (where x
is the time in seconds). After that, just destroy it.
new = Instance.new("Hint") wait(2) -- wait two seconds new:Destroy() -- removes it