Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Group rank and team based uniform?

Asked by 2 years ago

I have a question, how do I make a Group only uniform based on the team? For example, if you joined the Blue team (which have group bound) you'll get the uniform based on rank, but if you join Red Team, you'll not get the uniform because you're not in the Red team's Group?

0
I want kindly remind you that this is not a REQUEST site. In case, you will try to figure out, it yourself and have any bugs or errors then post them here or as a new question. Add me at discord and I will help you in my free time. ErtyPL 129 — 2y
0
Note: There are a million ways to achieve what you want to. My discord is: ErtY#9909 ErtyPL 129 — 2y
0
Ah okay thanks thanks SatriaKaneSantoso 0 — 2y

2 answers

Log in to vote
0
Answered by
SuperPuiu 497 Moderation Voter
2 years ago

Example (If it is a roblox group) :

game.Players.PlayerAdded:Connect(function(Player)
  Player.CharacterAdded:Connect(function(char)
    if Player:GetRankInGroup(GroupId) == 255 and Player.TeamColor == game.Teams.Red.TeamColor then -- Change GroupId to group id
                 print("Player is the owner of the red group")
           end
    end)
end)

Just an example, if it is what you needed, for shirt changing you have to search for player shirt in character instance and change the id

0
Where do i change the ID? SatriaKaneSantoso 0 — 2y
0
Player:GetRankInGroup(GroupId) Change GroupId SuperPuiu 497 — 2y
0
I've tried to Modify it by myself, but it didnt work like, even tho im not in that rank, im still getting the lower rank uniform, maybe if u have discord, I can message u on there SatriaKaneSantoso 0 — 2y
0
Weird, it should work. By the way, you have to change 255 to a rank ID from the group you want the player to be SuperPuiu 497 — 2y
View all comments (5 more)
0
I did, but whenever im in Guest rank (testing with alt), I get the 255 rank Uniform SatriaKaneSantoso 0 — 2y
0
plr:GetRankInGroup() == 0 will give a shirt to guests SuperPuiu 497 — 2y
0
yes im trying to give it to guest, didnt even give to guest, it gives to Owner of group SatriaKaneSantoso 0 — 2y
Ad
Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Hiya! o/

I'd go through this by creating a folder somewhere (ideally ReplicatedStorage) where it contains the rank's uniforms in different folders.

Hierarchy Breakdown

The backend would listen for when the player changes their team

Player:GetPropertyChangedSignal("Team"):Connect(function()
    -- Here I would get the player's team, and then rank in their group from that.
    local Rank = 256
    -- Then I would get the Folder for the rank
    local Uniforms = game.ReplicatedStorage.Uniforms:FindFirstChild(Player.Team.Name):FindFirstChild(Rank)
    -- Once I have the folder, loop through all children and replace any clothing in the character with the ones
    -- supplied in the folder.
    for __INDEX, Object in ipairs(Uniforms:GetChildren()) do
        -- Get the type of the object, and do stuff™
    end
end)

This system allows for easy expandability with clean code!

Answer this question