I need help with leaderstats. (Once again.)

Hello Developers,

I’m starting to think that this script i’ve been trying to make is not possible to make.

So, like there is already group rank leaderstats but i’m trying to create something beyond that. I want it that if your in (group ID) then your leaderstats name is “Eligible” and if your not your name is “Ineligible” but I keep trying to play around with the group rank script, and I can’t do it.

(summary) I don’t want it showing your ROLE name. I just want it that if your in the group your name on the leaderstats is “Eligible” and if not your name is “Ineligible”

Thanks, Justinn.

1 Like

just check if he’s in a group if so set the value to “Eligible” if not set it to “Ineligible”

game.Players.PlayerAdded:Connect(function(player)
    if player:IsInGroup(0) then
        player.leaderstats.value = "Eligible" -- Make this a path to the leaderstat value
   else
        player.leaderstats.value = "Ineligible" -- Make this a path to the leaderstat value
    end
end)
1 Like

The only difference is that your leaderstats Object won’t be visible to the other Players, unless if you meant a Value Object inside the leaderstats

Other then that as @AccessQ stated, use the Player:IsInGroup() function as this will return back a Bool (true/false)

local GroupID = 0 --Obviously replace this with your ID

local function PlayerAdded(Plr)
    local leaderstats = Instance.new("Folder")
    leaderstats.Parent = Plr

    if Plr:IsInGroup(GroupID) then
        leaderstats.Name = "Eligible"
    else
        leaderstats.Name = "Ineligible"
    end

end

game.Players.PlayerAdded:Connect(PlayerAdded)

Thanks, guys. I have a two questions for your replies.

  • Where does this script go?

  • Which one do I use? Both of those scripts look correct.

1 Like

As long as it’s within either the workspace, or ServerScriptService is fine

Your choice, only difference is that Access’s code you’ll need to create a leaderstats object otherwise it’ll error

1 Like

What so you mean by “Access Code?”

I’m sorry for so many questions. Still new to LUA. All I do is build.

1 Like

It’s fine :sweat_smile:

I meant the code that Access posted over here in Post 2, I was just referring to him as his username:

1 Like

Oh, i’m an idiot. Lol, I’m super sorry. Thank you so much!

2 Likes