My script won't kick the player

this is a script located in a textlabel, there is a yes and no button where the player answers, when all the questions are asked the textlabel’s text is : “You have run out of questions. Thank you for playing!”
and it has a scary vibe,
and it’s supposed to wait(0.5) to kick the player but it doesn’t kick the player.
script:

local YesButton = script.Parent.Parent.YES
local NoButton = script.Parent.Parent.NO
local player = game.Players.LocalPlayer
local questions = {
	"Have you ever seen something out of the corner of your eye that wasn't there when you looked directly at it?",
	"Would you spend the night alone in a haunted house for a million dollars?",
	"Do you believe in ghosts?",
	"Have you ever heard footsteps when you were home alone?",
	"Would you use a Ouija board to try to communicate with spirits?",
	"Have you ever felt like you were being watched, even when no one was around?",
	"Do you think mirrors can be portals to other worlds?",
	"Have you ever experienced sleep paralysis?",
	"Would you ever visit a cemetery at night?",
	"Do you think that some dreams can be premonitions?",
	"Have you ever had a nightmare that felt too real to be just a dream?",
	"Would you ever explore an abandoned building by yourself?",
	"Do you think some places can be inherently evil?",
	"Have you ever heard someone call your name when no one was around?",
	"Would you ever stay in a hotel room that is known to be haunted?"
}

local questionIndex = 1

local function askNextQuestion()
	if questionIndex <= #questions then
		script.Parent.Text = questions[questionIndex]
		questionIndex = questionIndex + 1
	else
		script.Parent.Text = "You have run out of questions. Thank you for playing!"
		YesButton.Visible = false
		NoButton.Visible = false
		wait(2)
		script.Parent.Text = "You're Dead."
		script.Parent.TextColor3 = Color3.new(1, 0, 0)
		wait(0.1)
		script.Parent.Text = "You have run out of questions. Thank you for playing!"
		script.Parent.TextColor3 = Color3.new(1, 1, 1)
		wait(0.5)
		player:Kick("The Darkness Has Manipulated Your Soul")
	end
end

YesButton.MouseButton1Click:Connect(askNextQuestion)
NoButton.MouseButton1Click:Connect(askNextQuestion)

askNextQuestion()
2 Likes

You can’t kick a player from a local script. Do it from a server script instead

3 Likes

You can kick the local player from a local script

2 Likes

well this is a client sided script cos its gui

Did you perhaps check the output? Studio sometimes doesn’t give the normal grey popup box if you get kicked.

cant open output when the last text shows up

Like, you can’t open Studio output, or you can’t open the Developer Console in-game?

both
charsssss1111111111111111111111111111

That’s really weird. Can you perhaps try testing the game on the Roblox client, outside of Studio?

i did well no errors no nothing, but it doesn’t kick

Well, I’m pretty much stumped. You can try to add print statements around your code to see what’s executing and what’s not.

Is there any Scripts that are interfering with this GUI?

no there isn’t
1111111111111111111

It isn’t possible because Kick() is a server-sided event, so the method is not available on a local script

When using this method from a LocalScript, only the local user’s client can be kicked.

Its written in the official documents

1 Like

Dont use this you dont need a remote event, you can kick the player locally

2 Likes

Gaslighting at its finest

When using this method from a LocalScript, only the local user’s client can be kicked.

1 Like

You’ll have to use print() statement instead to try and debug your code. Try adding some of them surrounding your :Kick function to see if they print or not in the console.

1 Like

Can you try it in roblox instead of studio? The kick command doesnt create a popup for me ins tudio