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

attempt to concatenate Instance with string line 11?

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)

1 comment

0

For Client Side Line 4 doenst work

1 answer

✓ Accepted answer

"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.."!")

2 comments

0

Still doesnt work

0

For the client side, also do "PlayerToGiveRankTo.Name"

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