Still have questions? Join our Discord server and get real time help.
0

# How do I make a brick not kill a specific humanoid?

Raccoonyz 893
8 months ago
Edited 8 months ago

Hi. I have this script below. However, for whatever reason, it isn't working. Nothing is getting killed at all, and I am very confused. Basically, I want a specific model to not be killed by the script.

function touch(part)
if part.Parent:FindFirstChild("Humanoid")~=nil then
if part.Parent.Name ~= "name of thing excluded from kill" then
hit.Parent:FindFirstChild("Humanoid").Health=0
end
end
script.Parent.touched:connect(touch)


What did I do wrong?

0

Hello, there was some confusion about your question but I seemed to have found an answer, inside of the part you want to kill the players and not the boss put in a ServerScript and put the following:

local bosshumanoid = 'Zombie' -- This is just an example

script.Parent.Touched:connect(function(hit)
local hum = hit.Parent:WaitForChild('Humanoid')
if hum.Name == bosshumanoid then
print('This is the boss')
else
hum:TakeDamage(100)
end
end)


I tested it in studio and it worked hopefully this helps you out!

0
Doesn't seem to work, for some reason Raccoonyz 893 — 8mo
0
Oof, can you please tell me what happend AntoninFearless 194 — 8mo
0
OHHH, I am dumb. It was a local script. That has been my issue all this time Raccoonyz 893 — 8mo
0
Oh ok, you had me worried for a second there. AntoninFearless 194 — 8mo
0
raid6n 2290
8 months ago
Edited 8 months ago

because of if part.Parent.Name ~= "name of thing excluded from kill" then it would work as it is looking for a username named name of thing excluded from kill

 script.Parent.Touched:connect(function(part)
if part.Parent:FindFirstChild("Humanoid") ~= nil then
part.Parent.Humanoid.Health = 0
end
end)

0
That kills everything though, which I don't want Raccoonyz 893 — 8mo
0
wdym, just one player like when everyone hits it only one person will be affected? raid6n 2290 — 8mo
0
No, I want it to not kill a specific model / humanoid. To do that, I have the if part.Parent.Name ~= "name of thing excluded from kill" then so it doesn't kill it. Raccoonyz 893 — 8mo
0
so you want to it do nothing? raid6n 2290 — 8mo
0
im comfused on what you want it to do raid6n 2290 — 8mo
0
explain it raid6n 2290 — 8mo
0
explain it raid6n 2290 — 8mo
0
I want it to not kill a specific model / humanoid. I want it to be able to kill the player, but not the "boss" I have. Raccoonyz 893 — 8mo
0
so your saying you want the script to kill an NPC only? raid6n 2290 — 8mo
0
the opposite Raccoonyz 893 — 8mo
0
wait hold on, so you want it to kill players but not your boss correct? AntoninFearless 194 — 8mo
0
yes Raccoonyz 893 — 8mo