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

Ah, I might’ve made a mistake around closestEnemyFunction.

script.Parent.Parent.Torso should be workspace.Minigunner to get the Minigunner (or somewhere to get to it).

1 Like

I’m getting error 17:39:09.387 - Torso is not a valid member of Folder

Darn.

Paste to script here to see all the changes made to pinpoint where it’s erroring.

 workspace.Minigunner.Torso.CFrame = CFrame.new(script.Parent.Parent.Torso.Position, ClosestEnemy.Parent.Torso.Position * Vector3.new(1,0,1) + script.Parent.Parent.Torso.Position * Vector3.new(0,1,0))

ah,

replace the script.Parent.Parents with the Minigunner so it gets the actual model. (aka game.Workspace.Minigunner.

1 Like

it was this already

game.Workspace.Minigunner.Torso.CFrame = CFrame.new(script.Parent.Parent.Torso.Position, ClosestEnemy.Parent.Torso.Position * Vector3.new(1,0,1) + script.Parent.Parent.Torso.Position * Vector3.new(0,1,0))

No I meant to use this one:

game.Workspace.Minigunner.Torso.CFrame = CFrame.new(game.Workspace.Minigunner.Torso.Position, ClosestEnemy.Parent.Torso.Position * Vector3.new(1,0,1) + game.Workspace.Minigunner.Torso.Position * Vector3.new(0,1,0))
1 Like

still getting error 20:22:43.777 - Torso is not a valid member of Folder

Hmm…
What does the blue text say after that? I gotta find that specific line to see why it’s causing that error.

20:22:43.778 - Stack Begin

20:22:43.778 - Script ‘Workspace.Minigunner.Tazer.Script’, Line 33 - function closestEnemyFunction

20:22:43.778 - Stack End

Hmm, line 33…

I just realized this bit: ClosestEnemy.Parent has to be ClosestEnemy.Value since it is a value after all. Maybe changing to that would work?

1 Like

i am still getting that same error

Hmm…

Now I’m clueless on which one is a folder and which one is a value/model without looking at the explorer pane…

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("ObjectValue", game.Workspace.Minigunner.Stats)
		NameValue.Name = 'ClosestEnemy'
		NameValue.Value = FastZombie.Torso
		TestEvent:Fire()
	   end
end
connection = FastZombie["Left Leg"].Touched:connect(onTouched)

this script enters a new value into the folder

Wait, why is FastZombie referring to a tool according to the script located in the Tool?

I’m also surprised that I’m the only one taking a shot on this for the past couple hours. I wonder if anyone else can take a shot on this…

1 Like