So i have a hotkey script, for a 3d menu. i have a list of buttons, and every time you press "S" i need it to go down one, and enable the second button, then the third if you press "S" again. And so on. How ever i cant figure out how to do it. I tried this.

	uis.InputBegan:connect(function(input, chatted)
		local player = game.Players.LocalPlayer
		local one = Sub3:FindFirstChild("P1")
		local two = Sub3:FindFirstChild("P2")
		local three = Sub3:FindFirstChild("P3")
		
	if chatted then
		if open == true then
			
		end
		
	else

	if surface.Visible == true then
		if Sub3.Visible == true then
			if input.KeyCode == Enum.KeyCode.S and down == 30 then
				
					if player.pv.Value == 1 then
						if two then
							two.PNAME.Image = "rbxassetid://3200090913"
							down = 31		
					print(down)
					sound2:Play()
					select = 1
					else print"could not find any players"
						end
					end
					
				end
		
			end
		end
end
	
end)
	end)


uis.InputBegan:connect(function(input, chatted)
		local player = game.Players.LocalPlayer
		local one = Sub3:FindFirstChild("P1")
		local two = Sub3:FindFirstChild("P2")
		local three = Sub3:FindFirstChild("P3")
		
	if chatted then
		if open == true then
			
		end
		
	else

if surface.Visible == true then
		if Sub3.Visible == true then
			if input.KeyCode == Enum.KeyCode.S and down == 31 and select == 1 then
				
					if player.pv.Value == 1 then
						if three then	
							two.PNAME.Image = "rbxassetid://3183168543"
							three.PNAME.Image = "rbxassetid://3200090913"
							down =  32		
					print(down)
					sound2:Play()
					else print"could not find any players"
						end
					end
					
			end
			end
	end
	end
end)

. If a down is 30 and they press "s" it changes the image of the first imagelabel. But in the second one it says if its = to "31" then change the first imagelabel back to the original image. and change "down" to 32 and change the second imagelabel to a new one. But it only does this for the second one. I cant figure out how to make it work. Any help would be appreciated thanks.

1 comment

1

try taking a look at lua meta tables