this is my first script it is in serverscriptservice and the script is called Twittercodes
local DataStoreService = game:GetService("DataStoreService")
local TwitterCodes = {
Free = {"Coins", 100},
Pet = {"Coins", 100000}
}
game.ReplicatedStorage.RedeemCode.OnServerInvoke = function(Player, Code)
local TwitterCodeStore = DataStoreService:GetDataStore("TwitterCodesStore2" .. Code)
local PlayerRedeemedCode = TwitterCodeStore:GetAsync(Player.UserId)
if TwitterCodes[Code] and not PlayerRedeemedCode then
local LeaderboardValueName = TwitterCodes[Code][1]
local AmountToGivePlayer = TwitterCodes[Code][2]
local LeaderboardValue = Player.leaderstats[LeaderboardValueName]
LeaderboardValue.Value = LeaderboardValue.Value + AmountToGivePlayer
TwitterCodeStore:SetAsync(Player.UserId, true)
return true
else
return false
end
end
this is my second script it is in startegui and then in a frame the scipt is called TwitterCodesScript
local RedeemFrame = script.Parent.RedeemFrame
local CodeBox = RedeemFrame.CodeBox
local RedeemButton = RedeemFrame.RedeemButton
local ToggleButton = script.Parent.ToggleButton
ToggleButton.MouseButton1Click:Connect(function()
RedeemFrame.Visible = not RedeemFrame.Visible
end)
RedeemButton.MouseButton1Click:Connect(function()
local Code = CodeBox.Text
local Redeemed = game.ReplicatedStorage.RedeemCode:InvokeServer(Code)
if Redeemed == true then
CodeBox.Text = ""
CodeBox.PlaceholderText = "Redeemed Code!"
wait(1)
CodeBox.PlaceholderText = "Twitter Code Here"
else
CodeBox.Text = ""
CodeBox.PlaceholderText = "Invalid Code"
wait(1)
CodeBox.PlaceholderText = "Twitter Code Here"
end
end)
if you need to know anything more to answer my question please ask it i will add it then

2 comments
are you sure you need two codes? why 2? I cna help you if you tell me that
well te first script is the one that tells the computer what the codes are and how mutch Coins value they give. the second script is for the frame that if the codes are wrong it should tell the player invalid code and if its good it should tell the player Redeemed code. The problem is that the codes i have made in the first script if i fill that codes in it keeps saying invalid code