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).
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).
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.Parent
s with the Minigunner so it gets the actual model. (aka game.Workspace.Minigunner
.
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))
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?
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…