I’m trying to write a script that puts anyone above a specific role in my group into a separate team, but I can’t get it to work properly. All I need is for group admins to be placed in an admin team when they join the game. Any help would be greatly appreciated.
2 Likes
Can you show me your code you have right now? I can try my best to help you correct it
function OnEntered(player)
if player:GetRankInGroup(3441333) >= 0then
player.TeamColor = game.Teams["Team Name"].TeamColor
wait(0.01)
game.Players:FindFirstChild(player.Name):LoadCharacter()
end
end
game.Players.PlayerAdded:connect(OnEntered)
for _, player in pairs(game.Players:GetPlayers()) do
OnEntered(player)
local adminTeam = game:GetService("Teams").YOUR_TEAM
local adminGroup = 0
local adminRank = 0
game:GetService("Players").PlayerAdded:Connect(function (player)
if player:GetRankInGroup(adminGroup) < adminRank then return end
player.Neutral = false
player.Team = adminTeam
end)
2 Likes
How do you format text like that?
This isn’t working for me… when I join I’m still put in the neutral team.
There was a slight issue with the original code I gave you, I have since updated my original reply with the correct code. You need to set adminGroup
, adminTeam
& adminRank
accordingly.
I got it to work, I didn’t know you had edited your original reply. Thanks for your help.