shared.TwitterStatus = nil -- this is a shared Variable that can be accessed from any script in the game, It is currenty set to nil until we use it to prevent bugs local gear = game.ReplicatedStorage:WaitForChild("GravityCoil") game.Players.PlayerAdded:connect(function(plr) shared.TwitterStatus = false -- now that we are using it, it is no longer nil and has a value. --It is also setting the variable once when the player is added to prevent it from being added again when player respawns script.Parent.MouseButton1Click:connect(function() if script.Parent.Parent.Input.Text == 'Alpha!' and shared.TwitterStatus == false then shared.TwitterStatus = true -- now that it is true, it cannot be ran in this condition again. But as i said before, it can be edited from any script, so u can change it later gear:Clone().Parent = game.Players.LocalPlayer.Backpack script.Parent.Parent.Input.Text = '' script.Parent.Text = 'Success!' wait(1) script.Parent.Text = 'Submit' else script.Parent.Parent.Input.Text = 'Submit' script.Parent.Text = 'Invalid Code' wait(1) script.Parent.Text = 'Submit' end end) end)
Bleh. Putting something in Backpack is temporary, the item gets removed when you die/leave the game.
But if you want to do it manually:
local debounce = false if debounce == false and script.Parent.Parent.Input.Text == 'Alpha!' then debounce = true -- code end
EDIT:
This is a script inside a twitter code gui. Hierarchy:
Script:
local item = game.ReplicatedStorage:WaitForChild("ItemName") local debounce = false local button = script.Parent.Button local input = script.Parent.Input local code = "code" local starterText = "Enter Twitter code here" button.MouseButton1Down:connect(function() if debounce == false and input.Text == code then debounce = true local clone = item:Clone() clone.Parent = game.Players.LocalPlayer.Backpack elseif input.Text ~= code then input.Text = "Invalid Code" elseif debounce == true then input.Text = "Already entered code for this life" end end)