So, I have a script where when a player enters, depending on their rank in a group, a certain chat message is sent. But, of course, it doesn't work :/
IT IS A LOCAL SCRIPT
game.Players.PlayerAdded:connect(function(p) if p:GetRankInGroup(2567972) >= 3 and p:GetRankInGroup(2567972) >= 254 then game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{ Text = "A member of staff, "..p.Name.." has joined"; Color = Color3.new(51,255,51); Font = Enum.Font.SourceSans; FontSize = Enum.FontSize.Size24; }) elseif p:GetRankInGroup() >= 1 and p:GetRankInGroup(2567972) <= 2 then game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{ Text = "A patient, "..p.Name.." has joined"; Color = Color3.new(51,255,51); Font = Enum.Font.SourceSans; FontSize = Enum.FontSize.Size24; }) elseif p:GetRankInGroup() == 255 then game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{ Text = "The Director, "..p.Name.." has joined"; Color = Color3.new(51,255,51); Font = Enum.Font.SourceSans; FontSize = Enum.FontSize.Size24; }) else game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{ Text = "A guest, "..p.Name.." has joined"; Color = Color3.new(51,255,51); Font = Enum.Font.SourceSans; FontSize = Enum.FontSize.Size24; }) end end) game.Players.PlayerRemoving:connect(function(p) if p:GetRankInGroup(2567972) >= 2 and p:GetRankInGroup(2567972) >= 254 then game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{ Text = "A member of staff, "..p.Name.." has left"; Color = Color3.new(255,0,0); Font = Enum.Font.SourceSans; FontSize = Enum.FontSize.Size24; }) elseif p:GetRankInGroup() >= 1 and p:GetRankInGroup(2567972) <= 2 then game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{ Text = "A patient, "..p.Name.." has left"; Color = Color3.new(255,0,0); Font = Enum.Font.SourceSans; FontSize = Enum.FontSize.Size24; }) elseif p:GetRankInGroup() == 255 then game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{ Text = "The Director, "..p.Name.." has left"; Color = Color3.new(255,0,0); Font = Enum.Font.SourceSans; FontSize = Enum.FontSize.Size24; }) else game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{ Text = "A guest, "..p.Name.." has left"; Color = Color3.new(255,0,0); Font = Enum.Font.SourceSans; FontSize = Enum.FontSize.Size24; }) end end)
Several times throughout the script, in GetRankInGroup(), you never specified the groupId!