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

Why does this script keep giving people that is not my username the rank of teacher?

Okay so, this script is in ServerScriptService and for some reason it keeps giving people that aren't me, the rank of "teacher" Does anyone know how I can fix this problem and/or how I can fix it?

game.Players.PlayerAdded:connect(function(Player)
	if Player.Name == "LennonLight" then-- Lead Developer
       	 	Player.Team = game.Teams:FindFirstChild("Lead of Development")

	elseif Player:GetRankInGroup(4063626) == 237 or 238 or 239 or 240 then -- Teachers
		Player.Team = game.Teams:FindFirstChild("Teachers")
		
    	elseif Player:GetRankInGroup(4063626) == 89 or 90 then -- Students
       	 	Player.Team = game.Teams:FindFirstChild("9th Grade")

	elseif Player:GetRankInGroup(4063626) == 246 or 247 or 248 then -- MR
       	 	Player.Team = game.Teams:FindFirstChild("Middle Ranks")

	elseif Player:GetRankInGroup(4063626) == 249 or 250 or 251 then -- HR
       	 	Player.Team = game.Teams:FindFirstChild("High Ranks")

	elseif Player:GetRankInGroup(4063626) == 252 or 253 or 254 and Player.Name ~= "LennonLight" then -- SHR
       	 	Player.Team = game.Teams:FindFirstChild("Superior High Ranks")

	elseif Player:GetRankInGroup(4063626) == 255 then -- Founder
       	 	Player.Team = game.Teams:FindFirstChild("Founder")
    	end
end)

1 comment

0

You are using 'or' incorrectly. You have to include the 'Player:GetRankInGroup(4063626)' line with each number you are checking

1 answer

✓ Accepted answer
Example:

--easy way
game.Players.PlayerAdded:connect(function(player)
	local PlayerRank = Player:GetRankInGroup(4063626)
	if Player.Name == "LennonLight" then 
		Player.Team = game.Teams:FindFirstChild("Lead of Development")

	elseif PlayerRank >= 237 and PlayerRank <= 240 then 
		--teachers
	end
end)

--long way (in case easy way doesn't work)
game.Players.PlayerAdded:connect(function(player)
	local PlayerRank = Player:GetRankInGroup(4063626)
	if Player.Name == "LennonLight" then 
		Player.Team = game.Teams:FindFirstChild("Lead of Development")

	elseif PlayerRank == 237 or PlayerRank == 238 or PlayerRank == 239 or PlayerRank == 240 then 
		--teachers
	end
end)

2 comments

0

Should maybe explain what you did next time. And what they did wrong.

0

@outlook read my comment above

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