Was messing around with keybinds and realized that when using a menu, if an item on the menu has a key binded to it, it will open the connected bind, but will not open the menu, ex:
robloxapp-20210919-0002144.wmv (692.9 KB)
Hey @ForeverHD I was wondering if its a way to like have max selected. cause i got 2 SetMenu
and when i click the SetMenu1 it opens and when i click SetMenu2 it opens but i want if like SetMenu1 is opened and you click setmenu2 Setmenu1 closes
Is there a way to make it so that if a user doesnt have a certain rank in a group or above a certain icon doesnt show?
How do I make a button that doesn’t toggle when I click it? I just want it to activate a function every time I click it. The default behavior seems to be that the button toggles between selected and deselected states when it is clicked.
Just deselect the button when its clicked, then run the function you want to run. icon:deselect()
check if the player is the minimum rank using Player:GetRankInGroup, then if they are eligible to view the button, run icon:SetEnabled(true) (Make sure to run icon:SetEnabled(false) when creating the button)
note: this is not secure and exploiters can bypass this, make sure to run checks on the server when a remoteevent or remotefunction is fired
Please could I get some help setting this up due to my ‘IF’ function will not work.
Sure, here is some example code! I’ve commented it so you can hopefully understand what is going on.
local TopBar = require(game:GetService("ReplicatedStorage").Icon)
local Icon = TopBar.new() --// Creates your icon
local GroupID = 0000000 --// Your group ID goes here
local MinimumRank = 5 --// Any rank equal or higher than this will see the icon
local Player = game.Players.LocalPlayer --// The local player
-- . . . customise your icon here
Icon:setEnabled(false) --// Make it so a no one can see the icon
if Player:GetRankInGroup(GroupID) >= MinimumRank then --// If the player is equal or higher than the minimum rank (>=), we'll make the icon visible.
Icon:setEnabled(true)
end
Is it possible to have multiple different images within the same icon? For example I would like:
and I’d like to know if it’s possible to have multiple images in one icon, if so how, and whether you can toggle the transparancy of each one (if not, I’ve got a work around for this, but not for the multiple images one).
Welp the owner of this post said he won’t come back until November
Nevermind that, you actually can.
This is actually really cool. This will be useful for most roblox games in upcoming times
Woah! Definitely will use this in my future games!
https://cdn.discordapp.com/attachments/882304174056960011/899717823478263858/2021-10-18_18-56-53.mp4
buttons :)
love this module amazing job !!!
Hello! Does anybody know how to change a button’s image/text color on a specific state?
Nevermind, I figured it out, that you can somehow do it with themes.
Hey, so im having a little bit of trouble with this module, when i make a function to open a gui when clicked it doesnt works, it prints selected and deselected but it doesnt opens the gui no matter what i do, how would i fix this?
local SettingsGui = game.Players.LocalPlayer.PlayerGui.ScreenGui2
local Icon = require(game:GetService("ReplicatedStorage").Icon)
local icon = Icon.new()
:setImage(6031280882)
:setLabel("Hovering", "Settings")
:setLabel("Open", "Settings")
icon:setCaption("Settings (p)")
icon:setRight()
:bindToggleKey(Enum.KeyCode.P)
:bindEvent("selected", function()
print("selected!")
SettingsGui.Frame.Visible = true
end)
:bindEvent("deselected", function()
print("deselected!")
SettingsGui.Frame.Visible = true
end)
maybe because you’re setting it visible at all times…
I forgot to change that line, but it wasnt openning the gui
I found a fix at the playground already so yeah
How do i make it so it tweens a frame instead of just toggling the visible propertie? i already tried a lot of ways but it just didnt work
Heres the script
local Icon = require(game:GetService("ReplicatedStorage").Icon)
local player = game:GetService("Players").LocalPlayer
local playerGui = player.PlayerGui
local gui = playerGui:WaitForChild("Settings")
local SettingsGui = gui.TextLabel
local TweenService = game:GetService("TweenService")
local Close = TweenService:Create(SettingsGui:TweenPosition(UDim2.new(0.184, 0, -0.8, 0)))
local Open = TweenService:Create(SettingsGui:TweenPosition(UDim2.new(0.184, 0, 0.164, 0)))
local shopIcon = Icon.new()
:setImage(6031280882)
:setLabel("Settings", "Hovering")
:bindToggleKey(Enum.KeyCode.p)
:setCaption("Settings (p)")
shopIcon.deselected:Connect(function()
Close:Play()
end)
shopIcon.selected:Connect(function()
Open:Play()
end)
Do some research on the following
https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenPosition