Version 2 API - Stonetr03/TopbarButtonsModule GitHub Wiki

Topbar Buttons Module V2.0 API :

Adding a button

Adding a button

Module:Add("Button Name",ImageId, Left Side of Topbar true/false, Player)

The Player property is only required if called from the Server

This will return the button property, that can now allow you to call Button.MouseButton1Clicked or something like that

If there was an error or one of the required properties isn't filled out properly, the function will return false

The first property is the button name

The second property is the ImageId which will show up on the topbar

The third property is if you want it on the left side or the right side of the topbar, setting this value to true will make it on the left side, setting this value to false will make the button be on the right side of the topbar

The forth value is the player that the top bar will be added to ONLY USE IF ON SERVER, using on client will do nothing

image|203x98, 100%

Example

Server

local TopbarModule = require(5969925996)

local Button = TopbarModule:Add("Example Button","http://www.roblox.com/asset/?id=5010019455",true,game.Players:WaitForChild("Stonetr03"))

Button.MouseButton1Click:Connect(function()

    print("Clicked!")

end)

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

local Button = TopbarModule:Add("Client Example Button","http://www.roblox.com/asset/?id=5010019455",true)

Button.MouseButton1Click:Connect(function()

    print("Clicked!")

end)
Removing a button

Removing a button

Module:Remove("Button Name",Player)

This will return true if successfully removed, or the function will return false if there was an error while removing it

The first property is the Button Name

The second property is the player, ONLY USE IF ON SERVER, using on client will do nothing

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:Remove("Example Button",game.Players:WaitForChild("Stonetr03"))

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:Remove("Example Button")
Hiding a button

Hiding a button

Module:Hide("Button Name",Player)

This will return true if successfully hid, or the function will return false if there was an error while hiding it

The first property is the Button Name

The second property is the player, ONLY USE IF ON SERVER, using on client will do nothing

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:Hide("Example Button",game.Players:WaitForChild("Stonetr03"))

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:Hide("Example Button")
Showing a button

Showing button

Module:Show("Button Name",Player)

This will return true if successfully shown, or the function will return false if there was an error while showing it

The first property is the Button Name

The second property is the player, ONLY USE IF ON SERVER, using on client will do nothing

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:Show("Example Button",game.Players:WaitForChild("Stonetr03"))

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:Show("Example Button")
Changing a buttons image

Changing a button's image

Module:ChangeImage("Button Name", ImageId, Player)

This will return true if successfully changed, or the function will return false if there was an error while changing it

The first property is the Button Name

The second property is the ImageId also include the "rbxassetid://"

The third property is the player, ONLY USE IF ON SERVER, using on client will do nothing

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:ChangeImage("Example Button","http://www.roblox.com/asset/?id=5010019455",game.Players:WaitForChild("Stonetr03"))

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:ChangeImage("Example Button","http://www.roblox.com/asset/?id=5010019455")
Get notification value

Get Notification Value

Module:GetAmount("Button Name", Player)

This will return the amount in the notification icon, or the function will return false if there was an error while getting the value

The first property is the Button Name

The second property is the player, ONLY USE IF ON SERVER, using on client will do nothing

Example

Server

local TopbarModule = require(5969925996)

print(TopbarModule:GetAmount("Example Button", game.Players:WaitForChild("Stonetr03")))

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

print(TopbarModule:GetAmount("Example Button"))
Set Notification Value

Set Notification Value

Module:SetAmount("Button Name",Amount,Player)

This will return true if successfully set the amount, or the function will return false if there was an error while setting the value

The first property is the Button Name

The second property is the amount

The third property is the player, ONLY USE IF ON SERVER, using on client will do nothing

image|175x72

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:SetAmount("Example Button",10, game.Players:WaitForChild("Stonetr03"))

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:SetAmount("Example Button",10)
Add notification value

Add Notification Value

Module:AddAmount("Button Name",Amount, Player)

This will return true if successfully set the amount, or the function will return false if there was an error while setting the value

The first property is the Button Name

The second property is the amount

The third property is the player, ONLY USE IF ON SERVER, using on client will do nothing

image|169x60

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:AddAmount("Example Button",1, game.Players:WaitForChild("Stonetr03"))

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:AddAmount("Example Button",1)
Remove Notification Value

Remove Notification Value

Module:RemoveAmount("Button Name",Amount,Player)

This will return true if successfully set the amount, or the function will return false if there was an error while setting the value

The first property is the Button Name

The second property is the amount

The third property is the player, ONLY USE IF ON SERVER, using on client will do nothing

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:RemoveAmount("Example Button",1, game.Players:WaitForChild("Stonetr03"))

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:RemoveAmount("Example Button",1)
Add Dropdown Button

Add Dropdown button

Module:CreateDropdownButton("Dropdown Button name","Topbar button name","Text",Player)

This will return the button instance if successfully added the button, or the function will return false if there was an error while adding the button

The first property is the Dropdown Button Name

The second property is the Name of the button that will be added too

The third property is the Text that will be added to the dropdown button

The forth property is the player, ONLY USE IF ON SERVER, using on client will do nothing

image|205x91

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:CreateDropdownButton("ExampleDropdown","TopbarButtonName","Dropdown Button!",game.Players.Stonetr03)

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:CreateDropdownButton("ExampleDropdown","TopbarButtonName","Dropdown Button!")
Remove Dropdown Button

Removing Dropdown button

Module:RemoveDropdownButton("Dropdown Button name","Topbar button name",Player)

This will return true if successfully removed the button, or the function will return false if there was an error while removing the button

The first property is the Dropdown Button Name

The second property is the Name of the top bar button that the Dropdown Button is in

The third property is the player, ONLY USE IF ON SERVER, using on client will do nothing

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:RemoveDropdownButton("ExampleDropdown","TopbarButtonName",game.Players.Stonetr03)

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:RemoveDropdownButton("ExampleDropdown","TopbarButtonName")
Hide Dropdown Button

Hideing Dropdown button

Module:HideDropdownButton("Dropdown Button name","Topbar button name",Player)

This will return true if successfully hid the button, or the function will return false if there was an error while hiding the button

The first property is the Dropdown Button Name

The second property is the Name of the top bar button that the button is in

The third property is the player, ONLY USE IF ON SERVER, using on client will do nothing

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:HideDropdownButton("ExampleDropdown","TopbarButtonName",game.Players.Stonetr03)

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:HideDropdownButton("ExampleDropdown","TopbarButtonName")
Show Dropdown Button

Showing Dropdown button

Module:ShowDropdownButton("Dropdown Button name","Topbar button name",Player)

This will return true if successfully shown the button, or the function will return false if there was an error while hiding the button

The first property is the Dropdown Button Name

The second property is the Name of the top bar button that the button is in

The third property is the player, ONLY USE IF ON SERVER, using on client will do nothing

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:ShowDropdownButton("ExampleDropdown","TopbarButtonName",game.Players.Stonetr03)

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:ShowDropdownButton("ExampleDropdown","TopbarButtonName")
Edit Dropdown Button Text

Edit Dropdown button Text

Module:EditDropdownButton("Dropdown Button name","Topbar button name","New Text",Player)

This will return true if edited the button, or the function will return false if there was an error while hiding the button

The first property is the Dropdown Button Name

The second property is the Name of the top bar button that the button is in

The third property is the New Text

The third property is the player, ONLY USE IF ON SERVER, using on client will do nothing

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:EditDropdownButton("ExampleDropdown","TopbarButtonName","New Text!",game.Players.Stonetr03)

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:EditDropdownButton("ExampleDropdown","TopbarButtonName","New Text!")
Reset Dropdown Button Size

Reset Dropdown button Size

Module:ResetDropdownSize("Topbar button name",Player)

This will return true if reset the button size, or the function will return false if there was an error while hiding the button

The first property is the Top bar Button Name The second property is the player, ONLY USE IF ON SERVER, using on client will do nothing

Example

Server

local TopbarModule = require(5969925996)

TopbarModule:EditDropdownButton("TopbarButtonName",game.Players.Stonetr03)

Client

local TopbarModule = require(game.ReplicatedStorage.TopbarModule)

TopbarModule:EditDropdownButton("TopbarButtonName")
⚠️ **GitHub.com Fallback** ⚠️