Health pickups when player dies

Does anyone know know to make a health drop like when a player dies they drop a health pickup like in arsenal.

1 Like

The Developer Hub has an article on health pickups you can read to make the pickup itself:

In your case, you would use the Humanoid.Died event to start the health pickup script.

yes i read that already and i even have the codes for it. But im trying to make “When a player dies a health pack is dropped” like in arsenal.

I put like the part in starter pack and the code is

Local Script:

local part = script.Parent
local player = game.Players.LocalPlayer
local humanoid = player.Character.Humanoid

while true do
    if humanoid.Died then
        part:Clone().Parent = game.Workspace
    end
end

Something like this idk

Simply drop system.

This is script in ServerScriptService.


-- Example Code

local box = game.ReplicatedStorage.Box -- Your medkit

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		if humanoid then
			humanoid.Died:Connect(function()
				local humanoidRootPart = character.HumanoidRootPart
				local cf = humanoidRootPart.CFrame * CFrame.new(0, 2, 0) -- cframe
				
				-- cloning medkit 
				local clone = box:Clone()
				clone.Parent = workspace
				
				-- checking if medkit is model or part
				
				if box:IsA("Model") then 
					clone:PivotTo(cf)
				elseif box:IsA("Part") then
					clone.CFrame = cf
				else
					warn("Box isn't part or model!")
				end
			end)
		end
	end)
end)

I hope this helps!

1 Like

thanks man thats helped, really appreciate it.

1 Like
local players = game:GetService("Players")
local rs = game:GetService("ReplicatedStorage")
local medkit = rs:WaitForChild("Medkit")

players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
		humanoid.Died:Connect(function()
			local cf = humanoidRootPart.CFrame * CFrame.new(0, 4, 0) -- cframe
			local clone = medkit:Clone()
			clone.Parent = workspace
			if medkit:IsA("Model") then 
				clone:PivotTo(cf)
			elseif medkit:IsA("Part") then
				clone.CFrame = cf
			else
				print("Medkit isn't a part or model!")
			end
		end)
	end)
end)

I’d perhaps add these changes.