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

How would I make this work? [READ DESC.]

Asked by 8 years ago

Everything is right except there are 3 wrongs not 1(Wrong1,Wrong2,Wrong3).I can only fit one in though.Im trying to make it so that if the player gets the passcode wrong than 1 Wrong Gui (ex : Wrong1) will pop up and it does except I can add the rest of the wrongs (Wrong2 and Wrong3).How would I make this work?Also I don't know how to make it kick the player once they get the 3rd Try wrong , so if they get Wrong3.Any help there too?

local Code = script.Parent.Parent.Parent.Password.Code
local player = game.Players.LocalPlayer

function C()
if Code.Text == "2593316" then
    player.PlayerGui.EntryGui.ENTER.TextButton.TextTransparency = 1
    wait(.1)
    Code.TextTransparency = 1
    wait(.1)
    Code.TextStrokeTransparency = 1
else
    player.PlayerGui.EntryGui.Wrong1.Visible = true
    wait(.1)
        end
    end
script.Parent.MouseButton1Click:connect(C)
0
Can you please explain your problem better? Your explanation is not all that clear. And it also does not look like your code is of any relation as to what you're attempting to do. M39a9am3R 3210 — 8y
0
Sorry User#9821 0 — 8y

2 answers

Log in to vote
0
Answered by
Wutras 294 Moderation Voter
8 years ago
local Code = script.Parent.Parent.Parent.Password.Code
local player = game.Players.LocalPlayer
local wrongs = 0
function C()
if Code.Text == "2593316" then
    player.PlayerGui.EntryGui.ENTER.TextButton.TextTransparency = 1
    wait(.1)
    Code.TextTransparency = 1
    wait(.1)
    Code.TextStrokeTransparency = 1
else
    if wrongs == 0 then
    player.PlayerGui.EntryGui.Wrong1.Visible = true
        wrongs = wrongs+1
     wait(.1)
    elseif wrongs == 1 then
    player.PlayerGui.EntryGui.Wrong1.Visible = false
    player.PlayerGui.EntryGui.Wrong2.Visible = true
    wrongs = wrongs+1
     wait(.1)
    elseif wrongs == 2 then
    wrongs = wrongs+1
    player.PlayerGui.EntryGui.Wrong1.Visible = false
    player.PlayerGui.EntryGui.Wrong2.Visible = false
    player.PlayerGui.EntryGui.Wrong3.Visible = true
    wait(1)
    player:Kick() -- :Kick() is a function that is used to disconnect the Client from the server.
        end
    end
script.Parent.MouseButton1Click:connect(C)

There is if, else and elseif. if can be used to make conditions, else can be used if no condition fits the situation and elseif is like if, but with the difference that it only is being asked IF the previous ifs and elseifs are not matching. Also elseifs and elses are not in need of another end.

Ad
Log in to vote
0
Answered by 8 years ago

On the how to kick player:

player:Kick()

Good luck on Gui.

Answer this question