How do I allow my group admins to change player points through a GUI?

Hello developers,

I’m trying to make a system for my cafe group admins where they can have a GUI and if they click +1 point its gives the target user a point and if they click -1 point it takes away one and if they click reset it resets the target users points. How would I do this where the GUI only shows up for admins and connects to the leaderboard? Please leave any help/suggestions below on how I would achieve this. Here is the GUI I want to program swell.

You could start off by having events binded to the increase/decrease buttons so when the event fires, it updates the player’s stats accordingly.

Of course you would do simple checks such as group rank, if they are allowed to even access / call the remote, etc.

See here how remote Event work (@Syntheix I was going to say the same thing)

I would make a table of UserIds or Usernames and when the player joins check if the player’s name is in the table of Usernames. If it is, clone that gui out of replicated storage into their playergui.

One problem, exploiter can call the remote event without the GUI

Thats why you need to add security in your remoteEvent

Have a table in the server with the Usernames/UserIds. When they call the server with the remote event, the server can double check that their name matches the table.

It is usually frowned upon using names when getting or checking player information as names can be changed at anytime, but IDs can’t.

I highly suggest using Player Ids to verify information over Player names for a variety of reasons.

A simple server-sided check would to see if the player is the allowed rank, or is in the table of IDs you have made. If they are then keep processing the code, otherwise just don’t do anything.

1 Like

You need to use RemoteEvents. When a client fires an event to the server, the first argument would be the player who fired it, the second one should be the username of the person you want to give/take points to/from, and the third should be the action (give/take/reset)
On the server script, you should have a table with the userIds of the admins since you can’t allow anyone to do this.

The server script should look like this:

local admins = {12345678,87654321,34573457,4575745} -- Ids of the admins
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteWeAreUsing")

local function isAdmin(userId)
     for i, v in pairs(admins) do
            if v == userId then
                 return true
            end
     end
     return false
end

Remote.OnServerEvent:Connect(function(sender,user,action)
      if isAdmin(sender.UserId) then  --- Or, if you want, you can check if they have a certain rank in a group using sender:GetRankInGroup(*group id*)
             if game.Players:FindFirstChild(user) then
                    if action == "Give" then
                           game.Players:FindFirstChild(user).Points.Value += 1
                    elseif action == "Take" then
                           game.Players:FindFirstChild(user).Points.Value -= 1
                    else
                           game.Players:FindFirstChild(user).Points.Value = 0
                    end
             end
      end
end)

To make the GUI only show to admins, you need to do something similar with a localscript, where you check if the player is an admin, and if he’s one, you make the frame visible.

He can also use the rank of a player in the group too

Yes, I have commented next to the line where it is being checked if he’s an admin.
The group rank method is better since you don’t need to restart a server if you want to add someone as an admin, you just change their group rank.

I don’t see it sorry i just see the table and i was thought you don’t mentioning GetRankInGroup