local red = workspace.TestELS.Red
local blue = workspace.TestELS.Blue
local UIS = game:GetService("UserInputService")


UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.J then
		while true do
			red.Material = "Neon"
			wait(0.5)
			red.Material = "Plastic"
			blue.Material = "Neon"
			wait(0.5)
			blue.Material = "Plastic"
			red.Material = "Neon"
			if input.KeyCode == Enum.KeyCode.B then
				break
			end
		end
	end
end)

If the player presses b, the lights turn off, but it stays on.

2 comments

0

It doesn't work because it's checking if the original input key was B instead of J.

0

So how do I fix it?