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