Kick Info Doesn't Pop Up

They did this by using table.concat. They used the special newline character, \n, which puts the text on a new line.
You can achieve the same by doing this:

player:Kick(table.concat(kickinfo, "\n"))

LMK if this works or doesn’t work.

That didn’t work. Now it doesn’t really show anything except “You were kicked fromt his experience: You have been kicked from the game”
image

Output:

Server Kick Message:

local Administration = {"Comqts"}


local remoteevent = game:GetService("ReplicatedStorage"):FindFirstChild("Events"):WaitForChild("Kick")
remoteevent.OnServerEvent:Connect(function(player,playername,kickinfo)
	if table.find(Administration, player.Name) then
		for _,Players in pairs(game.Players:GetPlayers()) do
			if Players.Name == playername then
				Players:Kick(table.concat(kickinfo,"\n"))
			end
		end
	else
		player:Kick("You are not authorized to use this command.")
	end
end)

This is what I put, by the way.

table.concat doesn’t work with dictionaries

forgot this was a dictionary :\ no wonder it didn’t wrok

Do you have any other ideas, by chance?

Yes. You can remove the dictionary keys, and instead just have this:

local kickinfo = {
    "Administrator: "..game.Players.LocalPlayer.Name,
    "UserID: "..tostring(game.Players:FindFirstChild(playername).UserId),
    "Reason: "..reason,
    "Time: "..os.time()
}

With this, would I change the table.concat back to what I had before or?

Keep the server script exactly as it is. This is the only change that needs to be made.

image
How can I separate this stuff?

Did you use the newline character as well? the \n for the second parameter of table.concat?

image
Yes, I did

Looks like you can’t add newline to kick messages now:

Not sure how they did it in the source you showed.

Found a workaround. You can use string.rep(" ", 10) in order to create a fake newline.


local kickinfo = {
    string.rep(" ", 10) .. "Administrator: "..game.Players.LocalPlayer.Name,
    string.rep(" ", 10) .. "UserID: "..tostring(game.Players:FindFirstChild(playername).UserId),
    string.rep(" ", 10) .. "Reason: "..reason,
    string.rep(" ", 10) .. "Time: "..os.time()
}

@Comqts lmk if this works or doesn’t work.

Now it won’t kick because of a UserId error.

Players.Comqts.PlayerGui.ScreenGui.KickPanel.KickHandler:8: attempt to index nil with ‘UserId’

Could this perhaps be about the thing you said earlier?

That means it can’t find the player that you tried to kick. Are you sure you copied out the code exactly?

Turns out I just put my username in wrong; however, the string.rep thing isn’t working stil… I’ve tried bumping the number up a few as well.
image

This is probably because of 200 character limit on kick messages. Nothing I can do about it. Sorry.

1 Like

Well, thank you for trying. I’ll have to try and figure out some other way to do this.

1 Like

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