Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

RPG Code window doesn't work?

I was making the code window for my RPG which is in alpha, and I will give alpha testers the code, but no matter what code I put in, even if it the correct code, it doesn't seem to work. Help please!

local player = script.Parent.Parent.Parent.Parent.Parent
local code = "KS6GSH1GLP"
local bleedingsky = 334856307


script.Parent.Enter.MouseButton1Click:connect(function()
	if script.Parent.TextLabel.Text == code then
		script.Parent.Enter.Text = "Valid code - Teleporting in 2.5 seconds"
		script.Parent.Enter.BackgroundColor3 = Color3.new(0.3, 1, 0.3)
		script.Parent.Enter.Selectable = false
		wait(2.5)
		game:GetService("TeleportService"):Teleport(bleedingsky, player)
	else	
		script.Parent.Enter.Text = "Invalid code - Rejoin to retry"
		script.Parent.Enter.BackgroundColor3 = Color3.new(1, 0.3, 0.3)
		script.Parent.Enter.Selectable = false
	end
end)

1 answer

✓ Accepted answer

You wrote TextLabel instead of TextBox

local player = script.Parent.Parent.Parent.Parent.Parent
local code = "KS6GSH1GLP"
local bleedingsky = 334856307


script.Parent.Enter.MouseButton1Click:connect(function()
    if script.Parent.TextBox.Text == code then
        script.Parent.Enter.Text = "Valid code - Teleporting in 2.5 seconds"
        script.Parent.Enter.BackgroundColor3 = Color3.new(0.3, 1, 0.3)
        script.Parent.Enter.Selectable = false
        wait(2.5)
        game:GetService("TeleportService"):Teleport(bleedingsky, player)
    else    
        script.Parent.Enter.Text = "Invalid code - Rejoin to retry"
        script.Parent.Enter.BackgroundColor3 = Color3.new(1, 0.3, 0.3)
        script.Parent.Enter.Selectable = false
    end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.