Player:Kick() not working?

HD admin doesn’t seem to allow me to kick myself

1 Like

You’re the owner. Try with an alternate account. If you want to join a roblox game on two different accounts on the same device. Use the browser and the Microsoft Store roblox at the same time.

I can’t do that because I’m a Mac user, but I use another computer at the same time

out of curiosity, how u tried a pre-coded kick option? Like having a GUI button on your screen that has something like

script.Parent.MouseButton1Down:Connect(function()
  game.Players.LocalPlayer:Kick("Lol")
end)

I wonder if its something up with your dev console/

1 Like

Yes, I have tried it, but it was the same.

Just use a remoteevent and a localscript.

When the remoteevent fires the localscript activates and kicks it’s parent (player).

Also note that you can only use :Kick() in localscripts.

Using RemoteEvent for Kick is very dangerous.
Hackers can spoof RemoteEvent arguments.

Just add a checker that checks who fired the remote.

Wrong. You can also kick from the server.

You see if you would try kicking from a normal script it would error.

(From developer hub)

Code samples

local Players = game:GetService("Players")
 
local kickCommand = "/kick "
 
local function onOwnerChatted(player, message)
	if message:sub(1, kickCommand:len()):lower() == kickCommand:lower() then
		local name = message:sub(kickCommand:len() + 1)
		local playerToKick = Players:FindFirstChild(name)
		if playerToKick then
			playerToKick:Kick("You have been kicked by the owner.")
		else
			-- Couldn't find the player in question
		end
	end
end
 
local function onPlayerAdded(player)
	-- Restrict this command to only the creator/owner
	if player.UserId == game.CreatorId and game.CreatorType == Enum.CreatorType.User then
		player.Chatted:Connect(function (...)
			onOwnerChatted(player, ...)
		end)
	end
end
 
-- Listen for players being added
for _, player in pairs(Players:GetPlayers()) do
	onPlayerAdded(player)
end
Players.PlayerAdded:Connect(onPlayerAdded)

This is server side code

Well, someone find the cause please?

Something to check before you read the rest: I believe the kicked message is part of the core GUI. If you turned off parts or all of the core GUIs this may be your problem. Double check that none of your code unintentionally turning off the wrong parts or the core GUI.

The other player is being kicked/disconnected by the client isn’t displaying the message. This is probably either from a malfunctioning Roblox player application or some sort of setting in your game. Some ways you can see what the problem is are:
Make a blank baseplate and run a simple kick script
—There is some script messing with your coreGuis or settings
Try making your game public and running the game from another device
—If this works normally then it is your Roblox application

Edit: The kick menu is not in core GUI and there is no (know) way to turn it off.

If this is done correctly, should not have any problems.

Are you overriding your script environment? What kind of scripts run in your game?

It’s more likely that you aren’t doing it correctly. The server cuts the connection between the server and the client, it’s a C-Function. It would be possible that maybe your server is out of date. Please make sure it is, and if it’s not up to date you need to post it to bugs.

can you put this script inside a part

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then -- just to see if its a real player
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        -- kicking
        player:Kick("this was a test kick!")
    end
end)

im sure this should work probably

Terrain automatic generation program is running

Is this running in a studio team test or a real roblox server?

Can you send me the full script, my guess is that the kick feature is working but you never called the function or called it incorrectly.

1 Like

It didn’t work. same problem.

1 Like