i am making a following and killing npc. currently this script instantly kills the player but how would i make this script slowly kill the player. i need the player to lose 10 hp every second
and how would i make the npc not kill other npcs, i want it to just target the player
2 Likes
Where exactly is the script killing the player? You could do something along the lines of
repeat wait(1) [HUMANOID PATH].Health -= 10 until [HUMANOID PATH].Health == 0
1 Like
in a different script, here it is
to make it not kill other npcs:
local Players = game:GetService("Players")
script.Parent.Touched:Connect(function(hit)
local character = hit.Parent
local humanoid = character and character:FindFirstChildWhichIsA("Humanoid")
if humanoid and Players:GetPlayerFromCharacter(character) then
humanoid:TakeDamage(5)
end
end)
1 Like
thank you, you saved me so much time
2 Likes
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.