Here are some examples https://gyazo.com/531e4698f015f5048536affd7200ae44
Im aiming for where an controller can click one of play button and it will go to the next frame but the code I wrote it keeps fireing the A button which leades it to continue the same process over and over again instead of fireing the other buttons instead.
–//My Current Code
UserInputService.InputBegan:Connect(function(Key, EventSequence)
if Key.KeyCode == Enum.KeyCode.ButtonA then
for I = 0,1.5,0.05 do
script.Parent.Parent.MainGui.Background.Menu.Credit.TextButton_Roundify_12px.ImageTransparency = I
script.Parent.Parent.MainGui.Background.Menu.PlayButton.TextButton_Roundify_12px.ImageTransparency = I
script.Parent.Parent.MainGui.Background.Menu.SettingsButton.TextButton_Roundify_12px.ImageTransparency = I
script.Parent.Parent.MainGui.Background.Menu.Credit.TextTransparency = I
script.Parent.Parent.MainGui.Background.Menu.SettingsButton .TextTransparency = I
script.Parent.Parent.MainGui.Background.Menu.PlayButton.TextTransparency = I
RunService.RenderStepped:Wait()
end
script.Parent.Parent.MainGui.Background.Menu.Credit.Visible = false
script.Parent.Parent.MainGui.Background.Menu.PlayButton.Visible = false
script.Parent.Parent.MainGui.Background.Menu.SettingsButton.Visible = false
wait(1)
MenuFolder.Slots.Visible = true
end
end)
local maingui = gui -- your starting menu gui
local currentbutton = 0
UserInputService.InputBegan:Connect(function(Key, EventSequence)
if Key.KeyCode == Enum.KeyCode.ButtonA then
if maingui.Visible == true then
currentbutton += 1 -- makes the console player go to the next button and then making it slightly invisible to avoid confusion
maingui:FindFirstChild(currentbutton).BackgroundTransparency = 0.2
maingui:FindFirstChild(currentbutton - 1).BackgroundTransparency = 0
end
end
end)
However you only have 3 buttons so you need to do a some lines of script which makes the currentbutton to 1 and max 3
Got it to work by using GuiService, here is an example code for anybody who needs help with this in the feature.
local GuiService = game:GetService("GuiService")
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(Key, GameEvent)
if Key.KeyCode == Enum.KeyCode.ButtonA then--I used A for example you can change it to your likeing then
if GuiService.SelectedObject.Name == "TextButton" then--The Name of your Gui object here
--//Write your function here
end
end
end)