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

FocusLost not working?

Asked by 10 years ago
local player = game.Players.LocalPlayer

script.Parent.FocusLost:connect(function(enterPressed)
    if enterPressed and script.Parent.Text == "123" and player.Code.Value ~= "Code1" then
        script.Parent.Text = "Giving Reward"
        player.Points.Value = player.Points.Value + 10
        player.Code.Value = "Code1"     
    elseif enterPressed and script.Parent.Text ~= "123" then
        script.Parent.Text = "Incorrest Passcode"
    elseif enterPressed and script.Parent.Text == "123" and player.Code.Value == "Code1" then
        script.Parent.Text = "Already used Code"
    end
end)

I wanted this to check if they typed 123 and if so give them points, but if they type something else it goes Incorrect Passcode. But I would like it so if they typed 123 again it would stop them, as when they type in 123 the first time it sets a value inside the player to change and so if that value = Code1 then stop them from getting points and say Already used Code

Answer this question