code:
game.ReplicatedStorage.Events.Kick.OnServerEvent:Connect(function(player)
local reason = player.PlayerGui.ScreenGui.KickGui.Reason.Text
local text = reason
local playerID = player.UserId
local PLER = player.PlayerGui.ScreenGui.KickGui.Player.Text
local y = game.Players:FindFirstChild(PLER)
y:Kick(reason)
end)
error: 18:20:25.551 - ServerScriptService.Script:7: attempt to index nil with 'Kick'

1 comment
you are saying "game.Players:FindFirstChild(plrToKick)" two times, use a variable instead