so im making a game with a tombstone which is supposed to write something on the label when a player hits it. The problem is it only detects normal people, and it doesnt detect dead ragdolls. I'm not getting any errors, but here is what i made so far to make it work (it still doesnt tho)
local part = script.Parent local text = part.Parent.Part.SurfaceGui.BuriedNickname part.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then local plr = game.Players:GetPlayerFromCharacter(humanoid.Parent) text.Text = humanoid.Parent.Name .. "- died from some disease ~ lived for ".. plr.AccountAge .. " days." end end)
Is your Script a local script?
You can check wether it's dead or not by checking if its Health
is equal to zero, by doing humanoid.Health ~= 0
local part = script.Parent local text = part.Parent.Part.SurfaceGui.BuriedNickname part.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then if humanoid.Health ~= 0 then local plr = game.Players:GetPlayerFromCharacter(humanoid.Parent) text.Text = humanoid.Parent.Name .. "- died from some disease ~ lived for ".. plr.AccountAge .. " days." end end end)