Ok, so basically you have to hold E to hack a computer and then the door opens. Yep, you guessed it: It didn't work. Here's my code:

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input, gameProccessedEvent)
	if input.KeyCode == Enum.KeyCode.E then
		script.Parent.Text = "Keep holding..."
		wait(5)
		script.Parent.Text = "Hold E"
		local players = game.Players:GetChildren()
		for i = 1,#players do
			script.Parent.Parent.Parent.Screen.BrickColor = BrickColor.new("Lime green")
			script.Parent.Parent.Parent.Parent.Door.Audio:Play()
			local num = -1935.125
			repeat
				script.Parent.Parent.Parent.Parent.Door.Position = Vector3.new(743.918, num, -892.213)
				wait(0.05)
			until num == -1948.875 or num >= -1948.875
			script.Parent.Parent.Enabled = false
			script.Disabled = true
		end
	end
end)

Path: game.Workspace.Bank.Laptop.Interact.MainButton.LocalScript

What's wrong with it? This is going towards Cops and Robbers. Thanks!

(Also, if you know how, can you also tell me how to make it work only if they're less than 20 studs away?)

2 comments

0

Are you getting any errors? Give us more details.

0

No, no errors are coming through the Output