Kick isn't working

So, in a game I’m working on, I added a little easter egg where you die inside of a truck
That’s basically it, but the script to kick the player after the text has finished isn’t working.
Here’s the script.
local text = script.Parent

local blur = Instance.new("BlurEffect",game.Workspace.CurrentCamera)

local darkness = Instance.new("ColorCorrectionEffect",game.Workspace.CurrentCamera)

blur.Size = 4

wait(.3)

text.Text = ("What? Where, am I?")

wait(10)

text.Text = ("I feel dizzy, I think I'm going to pass out.")

wait(10)

text.Text = ("Is this really how I die?")

wait(10)

text.Text = ("Surrounded by an empty abyss?")

wait(10)

text.Text = ("I know nobody will answer my calls for help.")

wait(10)

text.Text = ("Earth was a nice place. Goodbye friends and family.")

wait(2)

text.Active = false

blur.Size = 48

darkness.Brightness = 0

game.Players.LocalPlayer:kick("You have died.")

Everything works fine, besides the kick script at the end. I just want this to work so I can release this easter egg.

1 Like

The k in kick should be in uppercase, like all other methods of the player:

game.Players.LocalPlayer:Kick("You have died.")
4 Likes

oh my god i am dumb thank you for solving this

1 Like

Kick and kick were supposed to work, But it is better to use :Kick()

1 Like

No, lowercase kick isn’t supposed to work. Kick is a new method so it was implemented using standard Roblox naming conventions (PascalCase). It wasn’t implemented at a time where lowercase methods were dominant, therefore does not have a deprecated lowercase alias.

2 Likes

So it only works in Studio practically?

1 Like

Doesn’t work at all. Use Kick to disconnect a client from the server.

2 Likes

okay so i am back, for some reason :Kick() isn’t working, the error message that i am getting is
16:30:02.781 - Players.Messeras.PlayerGui.ScreenGui.TextLabel.Script:24: attempt to index nil with ‘Kick’

2 Likes

Use a local script instead of a script

3 Likes

^ Are you doing it in a LocalScript right?

1 Like

The error is literal. What this is saying is that LocalPlayer is nil because Kick is an index of the Player (an Instance method, specifically), kind of like what you see with tables. You’re using a server script, for which LocalPlayer does not exist for. You should never be using a server script for PlayerGuis, only firing remotes to tell the client to make changes.

4 Likes

Okay let me do that because I usually use scripts instead of LocalScripts