Welcome to the Forums!
Join thousands of other Roblox members with a free account.
Create Forum Account

I want to script something so that when a certain rank in my Roblox group joins, they get cape :)

  • This website was created by Roblox members to replace the official forums (because Roblox shut them down) Join us if you like Roblox!

Malteesuh

New Member
Reputation: 0 / 0 / 0
Feb 17, 2021
8
1
3
Roblox
Malteesuh
I want to script something so that when a certain rank in my Roblox group joins, they get cape :)


Thanks for your help!
Malteesuh
 

thecatmeow1223

Active Member
Reputation: 1 / 0 / 0
Oct 24, 2020
595
9
155
43
an unknown place in the world
youtube.com
Roblox
TheMeowingNoob
To detect what rank a player is, you can use GetRankInGroup(). You can find more info here: https://developer.roblox.com/en-us/api-reference/function/Player/GetRankInGroup. You could use an player added event and achieve something like this:

Lua:
game.Players.PlayerAdded:Connect(function(player)
    if player:GetRankInGroup(groupid) == theranktheyneedtobe then
        --code to add Cape here
    end
end)

To add a cape, you could insert it into starter character and make it visible through code.
 
Solution

Malteesuh

New Member
Reputation: 0 / 0 / 0
Feb 17, 2021
8
1
3
Roblox
Malteesuh
To detect what rank a player is, you can use GetRankInGroup(). You can find more info here: https://developer.roblox.com/en-us/api-reference/function/Player/GetRankInGroup. You could use an player added event and achieve something like this:

Lua:
game.Players.PlayerAdded:Connect(function(player)
    if player:GetRankInGroup(groupid) == theranktheyneedtobe then
        --code to add Cape here
    end
end)

To add a cape, you could insert it into starter character and make it visible through code.
Correct me if I'm wrong but would this look anything like it (I'm new to Lua) :


game.Players.PlayerAdded:Connect(function(player)
if player:GetRankInGroup(groupid) == 254 then
else if player:GetRankInGroup(groupid) == 255 then
local function onCharacterSpawned(character)
local hum = character.Humanoid
local ss = game:GetService("ServerStorage")
local accessory = ss:WaitForChild("RedCape"):Clone()
hum:AddAccessory(accessory)
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterSpawned)
endgame.Players.PlayerAdded:Connect(onPlayerAdded)
end
end)
 

thecatmeow1223

Active Member
Reputation: 1 / 0 / 0
Oct 24, 2020
595
9
155
43
an unknown place in the world
youtube.com
Roblox
TheMeowingNoob
To detect what rank a player is, you can use GetRankInGroup(). You can find more info here: https://developer.roblox.com/en-us/api-reference/function/Player/GetRankInGroup. You could use an player added event and achieve something like this:

Lua:
game.Players.PlayerAdded:Connect(function(player)
    if player:GetRankInGroup(groupid) == theranktheyneedtobe then
        --code to add Cape here
    end
end)

To add a cape, you could insert it into starter character and make it visible through code.
Correct me if I'm wrong but would this look anything like it (I'm new to Lua) :


game.Players.PlayerAdded:Connect(function(player)
if player:GetRankInGroup(groupid) == 254 then
else if player:GetRankInGroup(groupid) == 255 then
local function onCharacterSpawned(character)
local hum = character.Humanoid
local ss = game:GetService("ServerStorage")
local accessory = ss:WaitForChild("RedCape"):Clone()
hum:AddAccessory(accessory)
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterSpawned)
endgame.Players.PlayerAdded:Connect(onPlayerAdded)
end
end)
The if statement to check if the players rank is 254 is not being used so I guess you can remove that, but apart from that it looks good 👍