Help with select API for console support

info ℹ️


  1. What do you want to achieve? Keep it simple and clear!

I will make my game optional for the console with it I fully redesign the ui


  1. What is the issue? Include screenshots / videos if possible!

I use the select API from Gui service but it not correct select items I have above buttons and a frame I will in that frame you can select items with the joystick and the dpad and the buttons above with button l2 and R2 so

Button y to toggle the buttons button X for settings open or close by default there also the same Select as the button bar and with L1 and L2 qeucq switch to frame

I can use the whole frame with select API but that not what I want




  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Research the Dev forum and docks

scripts


local UIS = game:GetService("UserInputService")
local GS = game:GetService("GuiService")

local frames = script.Parent.Parent.Parent.Parent.frames
local buttons = script.Parent.Parent.Parent.Parent.atop.btopitems

script.Parent.MouseButton1Click:Connect(function() 
	
	if UIS.GamepadEnabled then
		UIS.InputBegan:Connect(function(input) 
			
			if input.UserInputType == Enum.UserInputType.Gamepad1 then
				if input.KeyCode == Enum.KeyCode.ButtonR2 then
					for i,v in frames:GetChildren() do
						if v:IsA("ImageLabel") then
							v.Visible = false
							frames.ui.Visible = true
						end
					end
					
					GS:Select(frames.ui)
					GS:Select(script.Parent.Parent.Parent.Parent.Parent.backframe.buttons)
					
					for i,v in buttons:GetChildren() do
						if v:IsA("TextButton") then
							v.Visible = false 
							buttons.bhome.Visible = true
							buttons.usounds.Visible = true
						end
					end	
				end
			end
		end)
	else
		for i,v in frames:GetChildren() do
			if v:IsA("ImageLabel") then
				v.Visible = false
				frames.ui.Visible = true
			end
		end

		for i,v in buttons:GetChildren() do
			if v:IsA("TextButton") then
				v.Visible = false 
				buttons.bhome.Visible = true
				buttons.usounds.Visible = true
			end
		end	
	end
	
	
	



end)

local buttons = script.Parent.Parent.Parent.Parent.buttons
local enabled = true
local pading = script.Parent.Parent.Parent.Parent.frames.padding

local UIS = game:GetService("UserInputService")

script.Parent.MouseButton1Click:Connect(function() 
	
	if UIS.GamepadEnabled then
		UIS.InputBegan:Connect(function(input) 
			if input.UserInputType == Enum.UserInputType.Gamepad1 then
				if input.KeyCode == Enum.KeyCode.ButtonY then
					if enabled == true then
						buttons.Visible = false	
						pading.PaddingBottom = UDim.new(0, 0)
						enabled = false


					elseif enabled == false  then
						buttons.Visible = true
						pading.PaddingBottom = UDim.new(0.2, 0)
						enabled = true

					end
				end	
			end
		end)
		
	else
		if enabled == true then
	     	buttons.Visible = false	
		    pading.PaddingBottom = UDim.new(0, 0)
			enabled = false
			
		elseif enabled == false  then
		       buttons.Visible = true
		       pading.PaddingBottom = UDim.new(0.2, 0)
		       enabled = true
		
	    end
    end
end)


1 Like

I fixed that it buttons work but for the buttons there need a different button select like by clicking it opens frames and select buttons and by settings it select the settings frame in selector but how to archive

The buttons like L1 open next frame L2 previous and select the buttons.

1 Like

local UIS = game:GetService("UserInputService")
local GS = game:GetService("GuiService")

local frames = script.Parent.Parent.Parent.Parent.frames
local buttons = script.Parent.Parent.Parent.Parent.atop.btopitems

local butons = {
	script.Parent.Parent.Parent.Parent.buttons.button1.button,
	script.Parent.Parent.Parent.Parent.buttons.button2.button,
	script.Parent.Parent.Parent.Parent.buttons.button3.button,
	script.Parent.Parent.Parent.Parent.buttons.button4.button,
	script.Parent.Parent.Parent.Parent.buttons.button5.button,
	script.Parent.Parent.Parent.Parent.buttons.button6.button,

}

local function navigate()
	print("code runs 10")
	for i,v in frames:GetChildren() do
		print(i)
		print(v)
		if v:IsA("ImageLabel") then
			v.Visible = false
			print("it made it till 26")
			frames.frame2.Visible = true
		end
	end

	for i,v in buttons:GetChildren() do
		if v:IsA("TextButton") then
			v.Visible = false 
			print(i)
			print(v)
			buttons.bbutton1.Visible = true
			print("it made it till 37")
			buttons.ubutton3.Visible = true
			buttons.title.Text = "UI"
		end
	end
	script.Parent.Parent.Parent.Parent.buttons.button1.button.Image = "rbxassetid://17318147626"
	--script.Parent.Parent.Parent.Parent.buttons.button2.button.Image = "rbxassetid://17318147626"
	script.Parent.Parent.Parent.Parent.buttons.button3.button.Image = "rbxassetid://17318147626"
	print("it made it till 45")
	script.Parent.Parent.Parent.Parent.buttons.button4.button.Image = "rbxassetid://17318147626"
	script.Parent.Parent.Parent.Parent.buttons.button5.button.Image = "rbxassetid://17318147626"
	script.Parent.Parent.Parent.Parent.buttons.button6.button.Image = "rbxassetid://17318147626"
	script.Parent.Parent.Parent.Parent.buttons.button2.button.Image = "rbxassetid://17330399529"
	if UIS.GamepadEnabled then
		GS:Select(frames.frame2)
		print("it made it till 52")
		--[[script.Parent.Parent.Parent.Parent.buttons.button1.button.button.Enabled = false
		script.Parent.Parent.Parent.Parent.buttons.button2.button.button.Enabled = true
		script.Parent.Parent.Parent.Parent.buttons.button3.button.button.Enabled = false
		script.Parent.Parent.Parent.Parent.buttons.button4.button.button.Enabled = false 
		script.Parent.Parent.Parent.Parent.buttons.button5.button.button.Enabled = false
		script.Parent.Parent.Parent.Parent.buttons.button6.button.button.Enabled = false--]]
	end
	end
	
if script.Parent.Visible and main.Enabled then -- Check if the parent object is visible and enabled
	print("button clicked")
	if UIS.GamepadEnabled then
		UIS.InputBegan:Connect(function(input) 
			if input.UserInputType == Enum.UserInputType.Gamepad1 then
				if input.KeyCode == Enum.KeyCode.ButtonL1 then
					print("runninggg")
					navigate()
				end
			end
		end)
	else
		script.Parent.MouseButton1Click:Connect(function() 
			navigate()
		end)
	end
end```` i have this code but it doesnt work it did work before pls help i fixed that it only run if parent is visible but it not run this code function navigate properly it print everything but not change the properties