It doesn’t self trigger when i click, any button like R(KeyCode) to hit RC ‘TextButton’ < self trigger from the Keycode i press, connection. It you don’t understand, response here.
You can’t fire the MouseButton1Click event, instead create a function then connect it to the event and in the UIS onKeyPress just call the function after you’ve checked the keycode
So is impossible without Mouse1buttonclick, when i click Keyboard button, i see TextButton properties like it said, Active and Selected. Is there any way?
what you need to use is the context action service like this
local contextActionService = game:GetService("ContextActionService")
local KEY = "Key"
local button -- put the ui button here
local function OnBinded(actionName,inputstate,inputObj)
if actionName == KEY then
--put here what you want to happen
end
end
contextActionService:BindAction(KEY,OnBinded,false,Enum.KeyCode.R)
button.MouseButton1Click:Connect(OnBinded)
local function Clicked() -- make func
print("stuff you want to do")
end
script.Parent.RC.MouseButton1Click:Connect(Clicked) -- connect it to clicked
game:GetService("UserInputService").InputBegan:Connect(function(input, gpe) -- connect a func to input began
if gpe then return end -- check if user is chatting
if input.KeyCode == Enum.KeyCode.R then -- check if its r
Clicked() -- call func
end
end)
tbh CAS is kind of weird, isn’t it for holding down keys and not pressing them for toggle? When i was trying to use it for a menu it opened when i pressed q but closed when i let go
What will ‘RC’ button do is this, this is different script, but you know sometime when you use xbox and toggle gui it get clumsy, so it’s alot easier for users to press keycode like example Dpad right or left, Gui page flipping and then you don’t have to navigate.
I tested out my script, both the button and the R key printed out “stuff you want to do”
local function Clicked() -- make func
print("stuff you want to do")
end
script.Parent.RC.MouseButton1Click:Connect(Clicked) -- connect it to clicked
game:GetService("UserInputService").InputBegan:Connect(function(input, gpe) -- connect a func to input began
if gpe then return end -- check if user is chatting
if input.KeyCode == Enum.KeyCode.R then -- check if its r
Clicked() -- call func
end
end)
It did print out when i press R, I copy and paste on the script ‘stuff you want to do’ Note: Model i posted link is on the post for you to check out.
local function Clicked() – make func
print(“stuff you want to do”)
CurrentPage = 1 --the current page
function FlipPage(Way)
local NewPage = CurrentPage+Way – calculate which page should be the current page
if script.Parent.BFrame.MSFrame:findFirstChild(“Q”…NewPage)~=nil then – see if the new page exists
CurrentPage = NewPage
local P = script.Parent.BFrame.MSFrame:GetChildren()
for i = 1, #P do
P[i].Visible = false – first make every page transparent
end
script.Parent.BFrame.MSFrame:findFirstChild(“Q”…NewPage).Visible = true – show the right page
end
end
script.Parent.RC.MouseButton1Down:connect(function() FlipPage(1) end) – flip to the right
script.Parent.LC.MouseButton1Down:connect(function() FlipPage(-1) end) – flip to the left
end
script.Parent.RC.MouseButton1Click:Connect(Clicked) – connect it to clicked
game:GetService(“UserInputService”).InputBegan:Connect(function(input, gpe) – connect a func to input began
if gpe then return end – check if user is chatting
if input.KeyCode == Enum.KeyCode.R then – check if its r
Clicked() – call func
end
end)
About the left button, i was gonna do that further after the solve, then again THANK YOU!
Why do i want that, because it is for Xbox user i can eventually update whether button like DPad left or right