I'm trying to create a raiding system for war clans which includes a GUI with a few buttons which control the raid (i.e. making the raid official, voiding the raid). However, I need this GUI to only appear and be usable by HRs of a certain rank. This is my first time scripting something, so, as such, my lack of experience limits me from accomplishing my goal. The GUI itself is all done and scripted, but my only problem is having it only show up for certain players.
game.Players.PlayerAdded:connect(function(Player) if Player:GetRankInGroup(2565156) == 255 then script.Parent.ControlButton.Visible = true script.Parent.ControlButton.Selectable = true script.Parent.ControlButton.Active = true else script.Parent.ControlButton.Visible = false script.Parent.ControlButton.Selectable = false script.Parent.ControlButton.Active = false end end)
This is the script I created hoping it would work. I failed to realize that this would either make the GUI visible or invisible if an HR or non-group member or non-HR joined, respectively. I thought perhaps making the script a LocalScript would work since the GUI is in StarterGUI, but it didn't. I can't think of anything that would make the script only appear for certain players.
This task can be done in many ways, here are some suggestions
Example 1, cloning it You can make a server script that uses the PlayerAdded event, and checks if their in the group, if yes clone the gui from X storage (Could be ServerStorage because this would be serverscript) or what ever. (with Archivable set to
Example 2, deleting it from script You can put this gui in StarterGui and place a localscript, and check if they are in the group (take in consideration that I have never tried this function, so I do not know if it can only in a certain script (local or server script) so use remotes if you have to I guess.) if yes than leave the gui intact, if no destroy the gui from the playergui or script.Parent (depending on the tree).
These examples are just few of many, adventure through it I guess
Sorry for the typo, Im in real hours right now
Example 1 example (:3)
You could have a server script like
--I have my doubts about this, I have not actually tested this, it is an example --This is a serverscript local storage = game:GetService("ServerStorage") local players = game:GetService("Players") players.PlayerAdded:connect(function(player) if (player:GetRankInGroup(2565156) == 255) then local pgui = player:WaitForChild("PlayerGui") local cgui = storage:FindFirstChild("GuiToClone"):Clone() if (not cgui) then return end cgui.Name = string.format("%s's %s", player.Name, cgui.Name) cgui.Parent = pgui end end)
Use could use a remote event and then fire client for each individual and check if they are in the group or not. If you need an example i could add some code and show you the basic concept. Cheers.