How can I make a script that kicks a player on key press?

Imagine Synapse X users looking at this thread lol

LOL imagine they found that out XD

Synapse X is a script executor, not a script that makes you fly.

??? lol were saying like synapse x users will ry to run that script and fail lol

I don’t see the point of this when DarkDex exists and since its a local script it can be removed on the client using

game.Players.LocalPlayer.PlayerScripts.Script:remove()

You should use the UserInputService with .InputBegan, and then kick the LocalPlayer with game.Players.LocalPlayer:Kick(reasonString)

Then you shouldn’t even created this topic at the first place. Please start some basics first before you even ask.

local uis = game:GetService("UserInputService")
local isInChat = false
uis.TextBoxFocused:Connect(function()
    isInChat = true
end)
uis.TextBoxFocusEnded:Connect(function()
    isInChat = false
end)
game:GetService("UserInputService").InputBegan:Connect(function(inputObject)
    if inputObject.KeyCode == Enum.KeyCode.Z and isInChat == false then
        game.Players.LocalPlayer:Kick("Reason goes here!")
    end
end)

This also prevents them from getting kicked if they press the key while in a TextBox/Chat.

There is actually a much easier way to kick players when they press a button. Check ValentinRBX’s message. :slight_smile:

I think that this may be a bad idea just incase like someone accidentally presses the button

Nice script, however you forgot to put ) after function(inputObject.

1 Like

I’m not sure but does the second parameter of InputBegan / Ended count when using textbox?

1 Like

I don’t really know, as I’ve never needed to do that.

Typed that on phone

1 Like

Kick Brick

script.Parent.Touched:Connect(function(hit)

local player = game.Players:GetPlayerFromCharacter(hit.Parent)

player:Kick (–Reason)

end)