I do not know how to fix this GUI, whenever I enter a code in the script "Codes" it just shows "Submitting". It is not printing what it is supposed to be printing in output either.
local codes = require(game.ServerStorage.Codes) local usedCodes = game:GetService("DataStoreService"):GetDataStore("UsedCodes") local function IsInTable(t, thing) for i, v in pairs(t) do if v == thing then return(true) end end return(false) end game.Players.PlayerAdded:connect(function(player) if player.userId > 0 then local pCodes = usedCodes:GetAsync("user_" .. player.userId) if not pCodes then usedCodes:SetAsync("user_" .. player.userId, {}) end end end) function game.ReplicatedStorage.RedeemCode.OnServerInvoke(player, code) if player.userId > 0 then code = string.lower(code) if codes[code] then local pCodes = usedCodes:GetAsync("user_" .. player.userId) if pCodes then if not IsInTable(pCodes, code) then table.insert(pCodes, code) usedCodes:SetAsync("user_" .. player.userId, pCodes) codes[code](player) return true, "Success!" else return false, "You've already redeemed that code." end end else return false, "Invalid code." end end return false, "Sorry, guests can't redeem codes." end
Script with Codes (ServerStorage):
local codes = { ["supercode"] = function(player) print(player.Name .. " entered a code!") end, ["examplecode"] = function(player) print("this example code was redeemed by " .. player.Name) end, ["mlg_swag_360"] = function(player) print(player.Name .. " is mlg!!!1!11!") end ["test"] = function(player) print("this example code was redeemed by " .. player.Name) end, } return(codes)