Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[Answered] How can i give gear to a certain rank?

I'm not all that great with lua so i have no idea what i'm doing but i want a certain rank to get gear and this is what i have. It doesn't seem to work and i have no idea why, I used this same method for Rank Colors.

GroupId = 1141758

UnrefinedRank = newPlayer:GetRankInGroup(GroupId)

function onPlayerEntered(newPlayer)

if UnrefinedRank = 254 then
	 game.Lighting["Taser"]:Clone().Parent = newPlayer.StarterGear
end

if UnrefinedRank = 254 then
	 game.Lighting["Baton"]:Clone().Parent = newPlayer.StarterGear
end
end
game.Players.PlayerAdded:connect(onPlayerEntered)

2 answers

✓ Accepted answer

Try this!

GroupId = 1141758


game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:wait()
UnrefinedRank = player:GetRankInGroup(GroupId)
if UnrefinedRank >= 254 then
game.Lighting["Taser"]:Clone().Parent = player.StarterGear
game.Lighting["Baton"]:Clone().Parent = player.StarterGear
game.Lighting["Taser"]:Clone().Parent = player.Backpack
game.Lighting["Baton"]:Clone().Parent = player.Backpack
end
end)




9 comments

0

Is your exact rank number 254, or is it higher?

0

Okay, try the updated script.

0

What about now?

0

Did that work?

0

It works, but what does the < do? because i only want a certain rank to have it

0

I mean the >

0

I just realized that i just had to change > to = to make it ==

0

Thanks

0

I'd like to suggest looking into the GetRoleInGroup method. It returns the name of the rank the player has, rather than its value.

Alright, so the first thing I noticed wrong is your syntax.

GroupId = 1141758

UnrefinedRank = newPlayer:GetRankInGroup(GroupId)

function onPlayerEntered(newPlayer)

if UnrefinedRank == 254 then --One equals sign just means that a value is getting assigned to the object or variable. Use two equals signs to check if it's the same as.
     game.Lighting["Taser"]:Clone().Parent = newPlayer.StarterGear
end

if UnrefinedRank == 254 then
     game.Lighting["Baton"]:Clone().Parent = newPlayer.StarterGear
end
end
game.Players.PlayerAdded:connect(onPlayerEntered)

This discussion is preserved as it was. New answers, comments, and votes are closed.