How to make a player die upon joining?

Howdy, I was wondering how do I make a player reset upon joining?

local players = game:GetService(“Players”)

local function onPlayerAdded(player)
    local player = player
    local character = player.Character or player.CharacterAdded:Wait()
    local humanoid = character:FindFirstChild(“Humanoid”)
    humanoid.Health = 0


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.