#I need help on this as I am following a tutorial and the error doesn't seem to be adding up.
38 messages · Page 1 of 1 (latest)
can i see the code
Sure no problem
Studio is updating right now.
It just opened
It couldnt send
I think it reached the capacity
well send a .txt
well then i think its gonna be hard
** You are now Level 1! **
Error is this: ServerScriptService.Main.Tower:57: ServerScriptService.Main.Tower:15: attempt to perform arithmetic (sub) on Vector3 and Instance
Main.Tower:57 is coroutine.wrap(tower.Attack)(newTower)
Any Ideas?
I should have variables on everythinng
Should I send you a pic like that other guy?
local PhysicsService = game:GetService("PhysicsService")
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local events = ReplicatedStorage:WaitForChild("Events")
local spawnTowerEvent = events:WaitForChild("SpawnTower")
local tower = {}
function FindNearestTarget(newTower)
local maxDistance = 20
local nearestTarget = nil
for i, target in ipairs(workspace.Mobs:GetChildren()) do
local distance = (target.PrimaryPart.Position - newTower.PrimaryPart).Magnitude
if distance < maxDistance then
nearestTarget = target
maxDistance = distance
end
end
oh shoot
Alr
you arae doing target.PrimaryPart.Position - newTower.PrimaryPart
PrimaryPart is a instance
not a vector 3
oh
So I basically replace PrimaryPart with HumanoidRootPart?
Or vector 3
I'm not very good with instances.
I swapped all of them to HumanoidRootPart
Now it says this: ServerScriptService.Main.Tower:57: ServerScriptService.Main.Tower:34: attempt to index nil with 'Humanoid'
Any Ideas
** You are now Level 2! **