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

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

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)

2 comments

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.

0

Sorry

2 answers

✓ Accepted answer
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.

On the how to kick player:

player:Kick()

Good luck on Gui.

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