So basically i want the context action service gui to be a layer over mine anyone know how?
but context action service don’t have gui , you mean proximity prompt ?
i mean the mobile thing you know that touch button for mobile?
https://developer.roblox.com/en-us/api-reference/function/ContextActionService/GetButton
You can use GetButton to get the bound action’s mobile button and then you can manipulate that button like you would any GuiObject.
local contextAction = game:GetService("ContextActionService")
local function boundAction(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
print("Hello world!")
end
end
contextAction:BindAction("Print", boundAction, true)
local actionButton = contextAction:GetButton("Print")
actionButton.Position = UDim2.new(0, 0, 0, 0)
actionButton.Size = UDim2.new(1, 0, 1, 0)
I want it to change layors is that possible?
I had this problem too so I will share: Yes, it was possible and quite easy actually…
Those buttons create a normal player gui like any other. You need to get this gui and set its display order to something higher than DisplayOrders of your guis:
local Player = game:GetService("Players").LocalPlayer
local Guis = Player:WaitForChild("PlayerGui")
local CASGui = Guis:WaitForChild("ContextActionGui",math.huge)
CASGui.DisplayOrder = 100
I added math.huge because for computers the GUI will never be created and this will wait forever. Without the 2nd argument, after 5 seconds it would give a warning “Infinite yield possible…”, which doesn’t actually affect anything but why spam the output if you can avoid it..
Notice that every “variable” is used only once, this can be shortened to:
game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("ContextActionGui",math.huge).DisplayOrder = 100
Even though it’s been 3 years, I hope this will help other people too…