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

Would this be correct?

Hello everyone. I have this script, and it puts you on a certain team if you're in a group, and have the rank equal to or higher. As I am not the best at making scripts, I want to make sure my work is correct.

Here is the script below:

local ID = 737426

game.Players.PlayerAdded:connect(function(player)   
player.CharacterAdded:wait()
if player:GetRankInGroup(ID) == 4 then
    player.TeamColor = game.Teams["First Student"]
    player:LoadCharacter()
        else
    player.TeamColor = game.Teams["Civilian"].TeamColor
        player:LoadCharacter()
end
end

If anyone can answer, that would be much appreciated!

2 comments

0

As I am not at home and at school idk if this works

3

Lines 6 and 9's assignment is not consistent. Notice how in line 9 there's an additional '.TeamColor' versus the assignment in line 9.

2 answers

✓ Accepted answer

This is correct, other than line 06. You are attempting to set a player's teamcolor to a Team object. What you need to do is change the teamcolor the same way you do on line 09. You should also tab your code correctly, as it would make it easier to read.

local ID = 737426

game.Players.PlayerAdded:connect(function(player)   
	player.CharacterAdded:wait()
	if player:GetRankInGroup(ID) == 4 then
		player.TeamColor = game.Teams["First Student"].TeamColor
		player:LoadCharacter()
	else
		player.TeamColor = game.Teams["Civilian"].TeamColor
		player:LoadCharacter()
	end
end


1 comment

0

Thank you very much. I appreciate your answer.

Thanks for the answers. This question is solved and needs no more answers.

««««CLOSED»»»»

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