New Line In Script

I’m not sure why, but it won’t make a new line on the kick message, I don’t know if I have to do something else or if it doesn’t work in kick messages. Can somebody please help me with this?

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Folder = script.Parent

function onPlayerAdded(player)
	if not RunService:IsStudio() then
		for i,v in pairs(Folder:GetChildren()) do
			if v:IsA("NumberValue") then
				if player.UserId == v.Value then                    
		     		player:Kick("You are currently banned from The game.\n\nReason: " .. v.Reason.Value .. "\n\n" .. v.Time.Value)
   				end
			end
		end
	end
end

Players.PlayerAdded:Connect(onPlayerAdded)

for _, player in pairs(Players:GetPlayers()) do
	onPlayerAdded(player)
end
1 Like

What do you mean by a new line?

1 Like

What I Get:
Text1. Text2.

What I would like:
Text1.
Text2.

1 Like

Ohhhh! Okay, I think you might have to put extra spaces between messages so you could achieve something like that

1 Like

Alright, I’ll try that, thanks!

2 Likes

Yup. It should work cause roblox will have to automatically fill those spaces which causes the text to like this:

Text 1
Text 2

1 Like

If I recall correctly, Roblox removed the ability to insert new line characters inside of kick messages.

1 Like

Ah! Alright. Thank you. Not sure why they would remove that but, It’s okay! Thanks Guys!

Try using [[]] instead if "" because unlike using the second one, using the first will give you the ability to make strings with breaks without using \n

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Folder = script.Parent

function onPlayerAdded(player)
	if not RunService:IsStudio() then
		for i, v in ipairs(Folder:GetChildren()) do
			if v:IsA("NumberValue") then
				if player.UserId == v.Value then                    
		     		player:Kick([[You are currently banned from The game.

Reason: ]] .. v.Reason.Value .. [[

]] .. v.Time.Value)
   				end
			end
		end
	end
end

Players.PlayerAdded:Connect(onPlayerAdded)

for _, player in ipairs(Players:GetPlayers()) do
	onPlayerAdded(player)
end
1 Like

Alright, I’ll try this, I’ll let you know if it doesn’t work for me

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.