So I am trying make this script that spawns blood at the head area of a players humanoid whenever they die. It seems to not be working. It does print that the players humanoid has been found in the first script, but in the second script it should be printing that the player has died but it hasn't. These both scripts below are regular scripts not local, I want players to see it. I need other opinions on what might be the problem. Thanks
This is the parent of the script called "BloodScriptInsert"
function onPlayerRespawned(newPlayer)-- When player respawns
local h = newPlayer:FindFirstChild("Humanoid")-- Finds player humanoid
print("Player humanoid has been found!")
if h == nil then -- If script does not find player humanoid then
print("Player not found!")
local aScript = script.BloodScript:clone() -- Make a new variable called aScript and the clone the child bloodscript
local name = newPlayer.Name -- Players name
local player = script.Parent:findFirstChild(name) --Finds players name
aScript.Disabled = false -- disables "Ascript"
aScript.Parent = player -- The parent of "Ascript" is player
end
end
script.Parent.ChildAdded:connect(onPlayerRespawned) --Call event whenever a player resepawns
The child of the script above, this one is called "BloodScript"
local BloodCount = 100 -- Variable called bloodcount counts blood
function onPlayerDied(dead) -- This function will run whenever a players dies
print("Player had died") -- Checks if player had actually died
local head = script.Parent.head -- Locates players head
local RandomBlood = math.random(15, 100) -- sets blood drop to random range
local MaxBlood = RandomBlood -- Maxblood count equals that of random blood drop
while true do -- While this is true run this always
if BloodCount < MaxBlood then -- If the bloodcount is less than the maxblood run the script below
BloodCount = BloodCount +1 -- Adds a plus one to the blood count
local blood1 = Instance.new("Part") -- creates blood part
blood1.BrickColor = BrickColor.new(21)-- Sets blood color
blood1.formFactor = 2 --Sets blood size via up and down
blood1.Size = Vector3.new(1, 0.4, 1) -- Sets size via length, widith, and height
blood1.BottomSurface = 1 -- Sets button surface texture
blood1.TopSurface = 1 -- Sets top surface texture
blood1.Position = head.Position -- Sets blood postion to players head
blood1.Name = "Blood" -- Names Gives name to blood part
blood1.Parent = game.Workspace -- Sets blood parts parent to workspace, this way it will spawn in workspace and not somewhere else where you can't see the blood
--local Script1 = script.Script:clone() -- Makes a variable to clone script's parent
--Script1.Disabled = false -- Sets Parent script to become unactivated
--Script1.Parent = blood1 -- Sets blood bricks's child to become BloodScriptInsert
local WaitTime = math.random(1, 20) -- Sets waiting time
if WaitTime == 1 then
wait(0.03)
end
if WaitTime == 2 then
wait(0.02)
end
if WaitTime == 3 then
wait(0.03)
end
if WaitTime == 4 then
wait(0.02)
end
if WaitTime == 5 then
wait(0.02)
end
if WaitTime == 6 then
wait(0.01)
end
if WaitTime == 7 then
wait(0.01)
end
if WaitTime == 8 then
wait(0.01)
end
if WaitTime == 9 then
wait(0.01)
end
if WaitTime == 10 then
wait(0.01)
end
if WaitTime == 11 then
wait(0.01)
end
end
if BloodCount == MaxBlood then -- If the bloodcount is equal to maxblood count then return the value and then end the function
return end
end
end
script.Parent.Humanoid.Died:connect(onPlayerDied)--Whenever a player's humanoid dies run this script

2 comments
Are you sure its just not going to the position you want it to?
I have it written on line 06 on the second script that the head location is in Script.Parent.Head. Unless I have it written down wrong or there is another way of typing the head location on a players humanoid