Is this supposed to be a localscript, or a script? and where is it recommended to be?

Where can I put this script at? and is it supposed to be local or not?

local Lives = 5
game:GetService('Players').PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
			Lives = Lives - 1
			if Lives == 1 then
				game.StarterGui:SetCore("ChatMakeSystemMessage", 
					{
						Text = player.DisplayName.."(@"..player.Name..") now has".. Lives.. " Life!",
						Color = Color3.fromRGB(120, 0, 0),
						Font = Enum.Font.SourceSansBold,
						TextSize = 18,
					})
			else
				game.StarterGui:SetCore("ChatMakeSystemMessage", 
					{
						Text = player.DisplayName.."(@"..player.Name..") now has".. Lives.. " Lives!",
						Color = Color3.fromRGB(math.random(0,255), math.random(0,255), math.random(0,255)),
						Font = Enum.Font.SourceSansBold,
						TextSize = 18,
					})
			end
			if Lives == 0 then
				game.StarterGui:SetCore("ChatMakeSystemMessage", 
					{
						Text = "💀 "..player.DisplayName.."(@"..player.Name..") has died. 💀",
						Color = Color3.fromRGB(0, 0, 0),
						Font = Enum.Font.SourceSansBold,
						TextSize = 18,
					})
			end
		end)
	end)
end)
1 Like

Since there’s a PlayerAdded function, most of them are in a server script.