This is a Coupon code to earn players a reward Of VIP Access & VIP items in Shop, The Code does not work when Clicked the Submit button. And I have No idea what Am I missing.
while not _G["GameDatabase"] do wait() end
while not _G["GameDatabase"].ready do wait() end
local CheckBought = _G["GameDatabase"].action["CheckBought"]
local AddBought = _G["GameDatabase"].action["AddBought"]
local UpdateData = _G["GameDatabase"].action["UpdateData"]
local player = script.Parent.Parent.Parent.Parent.Parent
local pnm = player.Name
local codes = {
{"notafraid", true,
function()
if CheckBought(pnm, "PassVIP") then
return false
else
AddBought(pnm, "PassVIP")
return true
end
end,
"Shadows 2 VIP!"
},
}
main = script.Parent
local frs = {main.EnterCode, main.Invalid, main.YouGot, main.Expired}
function CloseAll()
for i = 1, #frs do
frs[i].Visible = false
end
end
CloseAll()
frs[1].Visible = true
local codebox = frs[1].code
codebox.Text = ""
local enter = frs[1].enter
local gotwhat = frs[3].gotwhat
gotwhat.Text = ""
local bounce = false
enter.MouseButton1Click:connect(function()
if codebox.Text == "" then return end
if bounce then return end
bounce = true
local gett = string.lower(codebox.Text)
local found = nil
for i = 1, #codes do
if string.lower(codes[i][1]) == gett then
found = codes[i]
break
end
end
if found == nil then
CloseAll()
frs[2].Visible = true
wait(5)
CloseAll()
frs[1].Visible = true
bounce = false
return
elseif found[2] == false then
CloseAll()
frs[4].Visible = true
wait(5)
codebox.Text = ""
CloseAll()
frs[1].Visible = true
bounce = false
return
else
local run = found[3]()
if run then
CloseAll()
frs[3].Visible = true
gotwhat.Text = found[4]
wait(7)
CloseAll()
codebox.Text = ""
frs[1].Visible = true
bounce = false
return
else
CloseAll()
frs[4].Visible = true
wait(5)
codebox.Text = ""
CloseAll()
frs[1].Visible = true
bounce = false
return
end
end
end)

3 comments
like, they type in a coupon code, and they get something for doing so and the code becomes invalid?
What do you mean the code does not work? Is there an error?
The Script Does not work when They Click the Enter Button