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

Would this be correct?

Asked by 9 years ago

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!

0
As I am not at home and at school idk if this works NikolaiGretsky 10 — 9y
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. Redbullusa 1580 — 9y

2 answers

Log in to vote
6
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

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


0
Thank you very much. I appreciate your answer. NikolaiGretsky 10 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

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

««««CLOSED»»»»

Answer this question