Need help with script

local groupId = 5774015 --REPLACE THIS WITH YOUR GROUPID
local TweenService = game:GetService("TweenService")
local minimumRankForRainbow = 6
game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local GuiClone = script.OverheadGUI:Clone()
		GuiClone.Parent = Character.Head
		
		local InformationLabel = GuiClone.InformationLabel
		
		local PlayerRank = Player:GetRoleInGroup(groupId)
		InformationLabel.Text = Player.Name .. "\n" .. PlayerRank
		if PlayerRank <= minimumRankForRainbow then
			while true do
				local Color = Color3.new(math.random(0,1),math.random(0,1),math.random(0,1))
				local ColorTween = TweenService:Create(InformationLabel,TweenInfo.new(3),{TextColor3 = Color})
				ColorTween:Play()
				wait(3)
			end
		end
	end)
end)

Error Message: 15:35:40.054 - ServerScriptService.OverheadGUI:13: attempt to compare string and number

Nevermind, solved it on my own

but how can you make it so that it only shows colors of the rainbow and not black and white?

The “PlayerRank” variable is a string, you can’t compare a string with a number. after the InformationLabel.Text = Player.Name .. "\n" .. PlayerRank,
add
PlayerRank = Player:GetRankInGroup(groupId) so it changes PlayerRank to the number your looking for.

Another way that works without queueing the server twice is to have a table with each rank thats allowed to have the rainbow, like this:

local groupId = 5774015
local TweenService = game:GetService("TweenService")
local rainbowRank = {
"Staff Assistant",
"Supervisor",
"Assistant Manager",
"Manager",
"Chief Staff Officer",
"Board of Directors",
"Developer",
"Vice President",
"President",
"Vice Chairman",
"Chairman"
}
game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local GuiClone = script.OverheadGUI:Clone()
		GuiClone.Parent = Character.Head
		
		local InformationLabel = GuiClone.InformationLabel
		
		local PlayerRank = Player:GetRoleInGroup(groupId)
		InformationLabel.Text = Player.Name .. "\n" .. PlayerRank
		if table.find(rainbowRank, PlayerRank) then
			while true do
				local Color = Color3.new(math.random(0,1),math.random(0,1),math.random(0,1))
				local ColorTween = TweenService:Create(InformationLabel,TweenInfo.new(3),{TextColor3 = Color})
				ColorTween:Play()
				wait(3)
			end
		end
	end)
end)

and to make it color rainbow replace
local Color = Color3.new(math.random(0,1),math.random(0,1),math.random(0,1))
with
local Color = Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255))

Enjoy lol

(Also, I joined ur group cause why not lol)

Thank you lol, are you a builder?

Not very much, I’m more of a scripter, sorry :sad:

K, also I did the 0,255 thing and it still does white and black

is it Color3.fromRGB? it doesnt work with just .new :v

local groupId = 5774015 --REPLACE THIS WITH YOUR GROUPID
local TweenService = game:GetService("TweenService")
local minimumRankForRainbow = 6


game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local GuiClone = script.OverheadGUI:Clone()
		GuiClone.Parent = Character.Head
		
		local InformationLabel = GuiClone.InformationLabel
		local PlayerRole = Player:GetRoleInGroup(groupId)
		local PlayerRank = Player:GetRankInGroup(groupId)
		InformationLabel.Text = Player.Name .. "\n" .. PlayerRole
		if PlayerRank >= minimumRankForRainbow then
			while true do
				local Color = Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255))
				local ColorTween = TweenService:Create(InformationLabel,TweenInfo.new(2),{TextColor3 = Color})
				ColorTween:Play()
				wait(2)
			end
		end
	end)
end)