local UsernameBox = game.Workspace.Computer.SurfaceGui.Frame.UsernameBox
local PasswordBox = game.Workspace.Computer.SurfaceGui.Frame.PasswordBox
local ValidAndInvalidBox = game.Workspace.Computer.SurfaceGui.ValidAndInvalidBox
local Player1 = game.Workspace.Computer.SurfaceGui.Frame.Player1.Value
local Player2 = game.Workspace.Computer.SurfaceGui.Frame.Player2.Value
local Player3 = game.Workspace.Computer.SurfaceGui.Frame.Player3.Value
local Player4 = game.Workspace.Computer.SurfaceGui.Frame.Player4.Value
local Player5 = game.Workspace.Computer.SurfaceGui.Frame.Player5.Value
local Password1 = game.Workspace.Computer.SurfaceGui.Frame.Password1.Value
local Password2 = game.Workspace.Computer.SurfaceGui.Frame.Password2.Value
local Password3 = game.Workspace.Computer.SurfaceGui.Frame.Password3.Value
local Password4 = game.Workspace.Computer.SurfaceGui.Frame.Password4.Value
local Password5 = game.Workspace.Computer.SurfaceGui.Frame.Password5.Value
local UsernameText = game.Workspace.Computer.SurfaceGui.Frame.UsernameBox.Text
local PasswordText = game.Workspace.Computer.SurfaceGui.Frame.PasswordBox.Text
local Pass = game.Workspace.Pass
local Pass2 = game.Workspace.Pass2
local Pass3 = game.Workspace.Pass3
local Light = Pass.Light
local Light2 = Pass2.Light2
local Light3 = Pass3.Light3
local Touch = Pass.Touch
local Touch2 = Pass2.Touch
local Touch3 = Pass3.Touch
local ValidAndInvalidBox = game.Workspace.Computer.SurfaceGui.ValidAndInvalidBox

script.Parent.SurfaceGui.Frame.LoginButton.Touched:connect(function()
		if UsernameText == Player1 and PasswordText == Password1 then
			wait(1)
			ValidAndInvalidBox.Text = ("Access Granted you may pass throught the door's!")
			Light.BrickColor = BrickColor.new("Sea green")
			Touch.CanCollide = false
			wait(7)
			Light.BrickColor = BrickColor.new("Bright red")
			Touch.CanCollide = true	
	else
			wait(1)
			ValidAndInvalidBox.Text = ("Access Denied! Please Try Again!")
	end
if UsernameText == Player2 and PasswordText == Password2 then
	wait(1)
	Light.BrickColor = BrickColor.new("Sea green")
	Touch.CanCollide = false
	wait(7)
	Light.BrickColor = BrickColor.new("Bright red")
	Touch.CanCollide = true
else
	wait(1)
	ValidAndInvalidBox.Text = ("Access Denied! Please Try Again!")	
end
if UsernameText == Player3 and PasswordText == Password3 then
	wait(1)
	Light.BrickColor = BrickColor.new("Sea green")
	Touch.CanCollide = false
	wait(7)
	Light.BrickColor = BrickColor.new("Bright red")
	Touch.CanCollide = true	
else	
	wait(1)
	ValidAndInvalidBox.Text = ("Access Denied! Please Try Again!")
end
if UsernameText == Player4 and PasswordText == Password4 then
	wait(1)
	Light.BrickColor = BrickColor.new("Sea green")
	Touch.CanCollide = false
	wait(7)
	Light.BrickColor = BrickColor.new("Bright red")
	Touch.CanCollide = true	
else
	wait(1)
	ValidAndInvalidBox.Text = ("Access Denied! Please Try Again!")
end
if UsernameText == Player5 and PasswordText == Password5 then
	wait(1)
	Light.BrickColor = BrickColor.new("Sea green")
	Touch.CanCollide = false
	wait(7)
	Light.BrickColor = BrickColor.new("Bright red")
	Touch.CanCollide = true
else
	wait(1)
	ValidAndInvalidBox.Text = ("Access Denied! Please Try Again!")
end
end)

6 comments

0

This is my code for a computer where it logd someone in if they have the same credentials.

0

Edited to use Code Block.

0

What is the problem? What are you trying to do? What's the error? Why would you post a code block on here with no context?

0

I am trying to make a login screen with a username and password when I publish the game, and I enter the game I click on the text box and nothing happens it's supposed to let you enter somethings in it. It doesn't allow me to do that. That's why I need the help to see if my script was wrong somehow.

0

Also this is only my third question in my account so I don't know how to use the inline code and stuff.

0

You managed to make it to the legends. If your question gets deleted then it won't count. But as of now, you're 4th from the most disliked question ever.