Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it possible to add Gui buttons to the Top Bar?

Asked by
NexeusX 137
7 years ago

As the title says is it possible to put a TextButton/ImageButton on the TopBar?

1 answer

Log in to vote
2
Answered by
Zeoic 40
7 years ago

Normally, no. As you normally use a text button, it would not be possible as the text button is put behind the top bar and is not clickable. With the UserInputService however, you can detect when the Mouse clicks, and where it is. So technically you can check if the mouse is over your button when it clicks and fire it that way. I have tested it, and it does detect mouse position and clicks while over the top bar.

This is what I used to test, you should be able to learn what you need for your button with this.

local UIS = game:GetService("UserInputService")
local Mouse = game.Players.LocalPlayer:GetMouse()

UIS.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        print(Mouse.X.." "..Mouse.Y)
    end
end)

Take a look at this wiki page for more information on the UserInputService's InputEnded event: http://wiki.roblox.com/index.php?title=API:Class/UserInputService/InputEnded

Ad

Answer this question