This is very odd, it should work, right? But it's not. You can click it as fast as you please and it's a problem.
Code:
local b = script.Parent
local screen = b.Parent.Screen
local hats = {["Euro 180"] = 401464679, ["Gold Ollie"] = 401464681, ["Red Grind"] = 401464684, ["Purple Indy"] = 401464683, ["Star Tailslide"] = 401464687}
local pose = {"Euro 180", "Gold Ollie", "Red Grind", "Purple Indy", "Star Tailslide"}
local db = false
local price = 100000
local items = game.ServerStorage.hatstorage
b.ClickDetector.MouseClick:connect(function(plr)
if db == false then
db = true
if plr.leaderstats.Coins.Value >= price then
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value - price
for key, v in pairs(hats) do
for i = .1, 4 do
wait(.1)
num = hats[pose[math.random(1, #pose)]]
screen.item.Texture = "rbxassetid://"..num
end
end
for key, v in pairs(hats) do
if v == num then
plr.PlayerGui.congrat.Frame.ya.Text = "You won a "..key.."!"
wait(2)
plr.PlayerGui.congrat.Frame.ya.Text = ""
local won = items:FindFirstChild(key):Clone()
won.Parent = plr.Inventory
end
end
end
end
wait(.2)
db = false
end)

1 comment
Please tab it correctly..