Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

RPG Code window doesn't work?

Asked by 8 years ago

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

Log in to vote
3
Answered by 8 years ago

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)
Ad

Answer this question