String not formatted correctly

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    trying to make a chat message making when someone completes something hard, it will print a message

  2. What is the issue? Include screenshots / videos if possible!
    string is not formatted correctly

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    tried to change where the args go on the script

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Line 7 is where the problem is (Printing messages when a player touches a part works completely fine if you were going to ask

local RepStorage = game:GetService("ReplicatedStorage")
local rE = RepStorage:WaitForChild("MadeAHardJump")


local function Complete(pName, Difficulty, partName, partColor)
	game.StarterGui:SetCore('ChatMakeSystemMessage', {
		Text = pName..' has completed a(n) '..tostring(Difficulty).. tostring(partName);
		Font = Enum.Font.GothamBlack;
		Color = partColor.Color;
		Size = Enum.FontSize.Size24;
	})
end

rE.OnClientEvent:Connect(Complete)

The output comes out like this for example:

Truss has completed a CATASTROPHIC!12.5 Stud Unclimbable!

but i was looking for it to be formatted like this (idk why theres too many exclamation points)

Truss has completed a CATASTROPHIC! 12.5 Stud Unclimbable!

am i using

tostring

wrong?

Text = pName..' has completed a(n) '..tostring(Difficulty).." "..tostring(partName);

You just need to concatenate an additional string which contains a single whitespace in order to split the other strings being concatenated.

You can use string.format with a proper template so you only have to pass the parameters(instead than concatenating a huge string):

local template = "%s has completed a(n) %s %s"
Text = template:format(pName, Difficulty, partName)
print(Text)

@Forummer @NyrionDev ill try both of these and whichever works, ill mark as solution ty