Hello. I am running into an issue with ContextActionService, specifically the ability for it to create GuiButtons
I create a button, and then I attempt to reposition is using :SetPosition(). However, this appears to fail to move the button.
I assume this is because the button is not yet created (which is its own can of worms), but if I use :SetTitle(), the method call works, and the string passed shows up.
ContextActionService:BindAction("VIBKeyboardForward", onForwardPressed, true, Enum.KeyCode.W)
ContextActionService:SetTitle("VIBKeyboardForward", "Hello")
ContextActionService:SetPosition("VIBKeyboardForward",UDim2.new(.3,0,.3,0))
(The title is set, but the position is not)
One thing that seems to work is to wait an amount of time (using task.wait() or task.delay(). One second works fine), however, waiting an arbitrary amount of time for things to be ready, and then assuming them to be ready sounds like a bad practice.
The ideal is an event of some sort that fires when the GuiButton is ready, but I could not find anything about that.
ContextActionService:BindAction("VIBKeyboardForward", onForwardPressed, true, Enum.KeyCode.W)
task.wait(1)
ContextActionService:SetTitle("VIBKeyboardForward", "Hello")
ContextActionService:SetPosition("VIBKeyboardForward",UDim2.new(.3,0,.3,0))
(Now both the title and position are set)
I really don’t understand what is going on here, and any help would be greatly appreciated.