game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(Message) local SplitMessage = Message:split(" ") if SplitMessage[1] == "/rank" then print("Command Is Correct") local NameOfPlayerToGiveRankTo = SplitMessage[2] local PlayerToGiveRankTo = game.Players:FindFirstChild(NameOfPlayerToGiveRankTo) local RankName = Message:split(NameOfPlayerToGiveRankTo)[2] PlayerToGiveRankTo.leaderstats.Rank.Value = RankName print(player.Name.." changed "..PlayerToGiveRankTo.."'s rank to "..RankName.."!") end end) end)
This is the client side notification
EventsFolder.NotifySender.OnClientEvent:Connect(function(PlayerToGiveRankTo, RankName) wait(0.5) game.StarterGui:SetCore("ChatMakeSystemMessage",{ Text = "You have changed ".. PlayerToGiveRankTo .."'s rank to ".. RankName .."!"; Font = Enum.Font.SourceSansBold; Color = Color3.fromRGB(85,255,0); TextSize = 18; }) end)
"PlayerToGiveRankTo" is an Instance (Player) which can be seen in line 07. You cannot concatenate (which in simpler terms means to "put together" pieces to form one string) an Instance with a string.
It seems you are trying to put the players username in the message, so change line 11
print(player.Name.." changed "..PlayerToGiveRankTo.."'s rank to "..RankName.."!")
to
print(player.Name.." changed ".. PlayerToGiveRankTo.Name .."'s rank to "..RankName.."!")