The position of a button should be located in the black circle, i can’t get the right position lol
Check if the Button’s scale is on the Scale and not the Offset?
Btw it’s a button from ContextActionService
Try setting the Position and Size of the Button to the Outline
Ok
This text will be blurred
I don’t really understand what you are trying to say sorry
So like the size of the UI, so something like this:
YourUi.Size = UDim2.new(0.1,0,0.1,0)
YourUi.Position = UDim2.new(0,0,0,0)
This is wrong, it’s not a GUI It’s a ContextActionService button
Can you show your Script please?
Alright
This text will be blurred
tool.Equipped:Connect(function()
equipped = true
player.PlayerGui.RevolverGUI.Enabled = true
player.PlayerGui.RevolverGUI.TextLabel.Text = tostring(ammo)
mouse.Icon = mouse_icon
local bindAction = CAS:BindAction("RELOAD", reload, true, "r")
CAS:SetPosition("RELOAD", position)
end)
This should be the part of the script that you need to see
SetPosition sets the position of the button, but i don’t know what the right position is and i can’t figure it out
The SetPosition method accepts a UDim2 data type as its second input. Meaning it will take the same position as something that is on the UI. To determine its position you could create a frame or button in the StarterGui so you can visibly see it and then just copy the position values to a new UDim2 instance. For example.
Here’s your button in your ScreenGui that you can delete once you get the values you want.
then add this to your code.
tool.Equipped:Connect(function()
equipped = true
player.PlayerGui.RevolverGUI.Enabled = true
player.PlayerGui.RevolverGUI.TextLabel.Text = tostring(ammo)
mouse.Icon = mouse_icon
local bindAction = CAS:BindAction("RELOAD", reload, true, "r")
local pos = UDim2.new(0.924, 0, 0.865, 0) -- The new instance
CAS:SetPosition("RELOAD", pos) -- Change position to the new instance
end)
This should set the ContextActionService button to the location on the screen you want.
That’s exactly that i did, but for some reason it does not change to the correct position
Does it change to the correct position for you?
So after some testing, I have discovered that the ContextActionService buttons are rooted within another GUI located on the bottom right of the screen. You can learn more about this by reading the Touch Buttons under the BindAction method on the Roblox Documentation. ContextActionService | Roblox Creator Documentation
You could originally start by setting the UDim2 to (0, 0, 0, 0) – This shows the button clearly on my screen.
and then going into the test enviornment where you could then manipulate the location to a spot you would like it to be. You can also use the method CAS:GetButton(“RELOAD”) to get the instance for the button you’ve created so you can customize it like a normal gui.
And by manipulate it I mean you can go into the PlayerGui and just edit the position copy the values from there.
I suggest not using a context action service button. Just place your own button that only appears if the last input type was a Mobile input type, and fire the action when it is tapped.
Yea you are right.
This text will be blurred
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.