I am trying to make a simon says sorta minigame, but it instantly solves itself without any user input. Is there any way to fix this?

local terminal = script.Parent
local prox = terminal.Union.ProximityPrompt
local PPS = game:GetService("ProximityPromptService")
local trmnlCompleted = false

local b1 = terminal.Button1
local b2 = terminal.Button2
local b3 = terminal.Button3
local b4 = terminal.Button4
local b5 = terminal.Button5
local b6 = terminal.Button6
local b7 = terminal.Button7
local b8 = terminal.Button8
local b9 = terminal.Button9

local buttons = {b1,b2,b3,b4,b5,b6,b7,b8,b9}

-------[Key]-------
local Input1 = b1
local Input2 = b6
local Input3 = b7
local Input4 = b3
local Input5 = b5
-------------------

local key = {Input1,Input2,Input3,Input4,Input5}
local Buttonclick = nil

function showkey()
	for i,v in pairs(key) do
		v.Color = Color3.new(0,1,0) 
		print(v)
		wait(0.7)
		v.Color = Color3.new(1,1,1)
	end
end

local function inputkey()
	for i,v in pairs(key) do
		Buttonclick = v.ClickDetector
		local function onMouseClick()
			v.Color = Color3.new(0,1,0)
		end

		Buttonclick.MouseClick:connect(onMouseClick)
	end
end

--------------------------------------------------------

prox.Triggered:Connect(function(player)
	prox.Enabled = false
	showkey()
	inputkey()
	for i,v in pairs(key) do
		v.Color = Color3.new(0,1,1)
	end
end)

1 comment

0

use if statement