Localscript isn't kicking player

So this code here detects what is inputted inside the textbox. In this source of text here detects what word has been put in, and if ’ :wega ’ has been inputted, it shall detect and function something. Although, when I want the localscript to kick the player, it doesn’t kick whilst everything else is working.

MessageBox.Changed:Connect(function()
	if MessageBox.Text ~= ":wega" or tick() - LastTime < 10 then return end
	
	wega:Play()
	WEGA.Visible = true
	game.Players.LocalPlayer:Kick("WOW")
	
	LastTime = tick()
end)

The localscript is inside of a gui > frame > imagelabel > textbox.
the script is inside the textbox.

I don’t believe you can kick people through a local script. Use a remote event to make it and a script in serverscriptserver with the rest of the code to kick the player.

You can’t kick a player inside a Local script. Use a remote event and pass the local plr as a argument. Then kick it on a server script. Example:

MessageBox.Changed:Connect(function()
	if MessageBox.Text ~= ":wega" or tick() - LastTime < 10 then return end
	
	wega:Play()
	WEGA.Visible = true
        remote_event:FireServer(game.Players.LocalPlayer)
	
	LastTime = tick()
end)
Server script:

remote_event.OnServerEvent:Connect(function(plr)
plr:Kick("WOW")
end)