Why am I getting the error 12:12:34.561 - Touched is not a valid member of Model

Check to see if the radius exists and is actually being touched by the zombie. Try changing

(hit.Parent.Name == "Minigunner")

to be able to detect the zombie since it looks for the minigunner instead.

1 Like

when I play test it, the radius is there and the zombies collide with it

Ah, so my assumption is that the script may be trying to check if the names of the zombies are "Minigunner"s. If itā€™s not, then it wonā€™t execute the rest.

You can either rename the zombies to ā€œMinigunnerā€ or change the ā€œMinigunnerā€ part to ā€œZombieā€ or whatever names you put for the zombies.

1 Like

This script is in the zombie model

FastZombie = script.Parent
local TestEvent = game.ReplicatedStorage.Events.TestEvent
function onTouched(hit)
	if (hit.Parent.Name == "Minigunner") then
		print('touched minigun radius')
		local NameValue = Instance.new("StringValue", game.Workspace.Minigunner.Stats)
		NameValue.Name = 'ClosestEnemy'
		NameValue.Value = FastZombie.Torso.Orientation
		TestEvent:Fire()
	   end
end
connection = FastZombie.HumanoidRootPart.Touched:connect(onTouched)

Interesting, so you want the minigunners to touch the radius thatā€™s in the zombie model in order for them to look at them?

Iā€™m kind of stumped here since I canā€™t seem to figure out if itā€™s the naming thatā€™s causing the issue.

I was trying to get the minigunners to look at the zombies when they touch the radius

Hmmā€¦

In the output, did it print ā€œtouched minigun radiusā€?

1 Like

no, it did not print that (30 characters)

ah, that means that the NPC that is touching the radius isnā€™t named ā€œMinigunnerā€ and wonā€™t run. Setting the names of the minigunners to ā€œMinigunnerā€ might be able to run the rest of the script.

1 Like

the minigunners were always named Minigunner

What about this line? Is the HumanoidRootPart the radius? What about ā€œMinigunRadiusā€? This makes it that it has to be touching the torso rather than the radius.

1 Like

I changed it to

connection = FastZombie["Left Leg"].Touched:connect(onTouched)

and now Iā€™m getting the error 16:35:08.141 - Workspace.Fast Zombie.Script:8: bad argument #3 (string expected, got Vector3)

Hey! Weā€™re getting thereā€¦

Now for this bit

local NameValue = Instance.new("ObjectValue", game.Workspace.Minigunner.Stats)
		NameValue.Name = 'ClosestEnemy'
		NameValue.Value = FastZombie.Torso

Make the changes right where it says NameValue, this uses the ObjectValue instead of the StringValue, so that way, the other script can actually see that part and get the position of it.

1 Like

Iā€™m getting error 16:53:54.138 - Torso is not a valid member of Folder

Darn.

Where is FastZombie referring to?

fast zombie is the name of the zombie

is there is a chance ur npc is R15 and thats why there is no torso?

every npc is r6 and has a torso

So FastZombie and ClosestEnemy are not Folders?

What about here? I forgot if FastZombie was supposed to be there instead of script.Parent.Parent.

fastzombie is the zombie, and closest enemy is a value inside of a folder