My monster doesn't care about my killpart

Hello I’m DarkBegin and I’m trying to make a kind of “Goomba” in my roblox 2D game.
I put a killpart in the player to kill a NPC.
But nothing works, no way to find a solution
My monster named Orlox has a Humanoid named Ghost, he has a script to walk from a part to another part which works. But there’s no way to kill it.
image
I enabled CanTouch everywhere in the monster, also in the killpart.
image


image

script.Parent.Touched:Connect(function(hit)
	print(hit)
	if hit.Parent:FindFirstChild("Ghost") then
		script.Parent.uno:Play()
		hit.Parent:destroy()
	end
end)

Any idea?

2 Likes

Are there any errors? if so show them

1 Like

try


if hit.Parent.Name == “Ghost” then


Hope this helps.

There’s no error, I put the print but there’s nothing

Are you sure about that ? image

you cant put scripts in StarterCharacter
they get removed when you spawn

1 Like

There aren’t any parts parented to the humanoid as far as I know.

Yes it’s welded to the HumanoidRootPart. The blue thing on the screenshot means it’s weld.

Its because you are not using the right characters for double quotes.

You can also try


if hit.Name == “Ghost” then


it depends what specific part you’re looking for, if it’s the parent’s name then add parent, if it’s the part then set it so it only checks part that is being touched properties

use StarterCharacterScripts or StarterPlayerScrips instead of directly placing it in the part

What does the print(hit.Name) say if u run the script

1 Like

i haven’t double checked but

there are two models inside so you should use “hit.Parent.Orlox” instead or just ungroup the dude walking

Oh thank you, I didn’t know!! Let’s put this script in another way

they said nothing prints and there are no errors
I’m on mobile, quoting works wierd

hopefully that solves it but i’m not sure why you don’t add a touch part on the top of the ghost’s head instead of adding a wide rectangle half below your player’s torso which can still kill the ghost if you just touch it with your waist

I don’t get it, the ghost head is a wide rectangle used to be touched

well i got confused for a second anyways did you read this

Can you explain more ? I don’t think my script will work fine if I put it alone in StarterCharacterScripts or StarterPlayerScrips.

I readed but the problem is we can’t use script in StarterPlayer