Hello!
So, I'm trying to create an Twitter Code script which would give free items when given the right code. But when I write the right code, it still says "Incorrect code!" which is supposed to be used ONLY when you have writen the wrong code. So, please HELP!
Here's the script!:
local storage = game.ReplicatedStorage local item = storage:FindFirstChild("Better Sword") script.Parent.MouseButton1Click:Connect(function() if script.Parent.Parent.TextBox == "firstcode" then script.Parent.Parent.TextLabel.Text = "Correct code!" wait(5) script.Parent.Parent.TextLabel.Text = "To find codes, pleae visit my TWITTER!: @TIKUTERs" wait(1) item:Clone().Parent = game.Players.LocalPlayer.Backpack item:Clone().Parent = game.Players.LocalPlayer.StarterGear print("Correct code given!") else script.Parent.Parent.TextLabel.Text = "Incorrect code!" wait(5) script.Parent.Parent.TextLabel.Text = "To find codes, pleae visit my TWITTER!: @TIKUTERs" print("Incorrect code given!") end end)
Hi!
Your script seems to work fine, except for the part where you actually check the code. Your attempt was:
if script.Parent.Parent.TextBox == "firstcode" then
This checks if the Textbox object equals a string, which obviously, it does not! Try adding ".Text" to it and see if it works then!
Full code:
local storage = game.ReplicatedStorage local item = storage:FindFirstChild("Better Sword") script.Parent.MouseButton1Click:Connect(function() if script.Parent.Parent.TextBox.Text == "firstcode" then script.Parent.Parent.TextLabel.Text = "Correct code!" wait(5) script.Parent.Parent.TextLabel.Text = "To find codes, pleae visit my TWITTER!: @TIKUTERs" wait(1) item:Clone().Parent = game.Players.LocalPlayer.Backpack item:Clone().Parent = game.Players.LocalPlayer.StarterGear print("Correct code given!") else script.Parent.Parent.TextLabel.Text = "Incorrect code!" wait(5) script.Parent.Parent.TextLabel.Text = "To find codes, pleae visit my TWITTER!: @TIKUTERs" print("Incorrect code given!") end end)