So I got the error Attempt to compare Vector3 And Number but I do not know why, I have seen many other people use what I am using but they do not get this error! I am trying to modify a tutorial and I was doing good until I had to use magnitude! Entire Script:
local UpdatePosition = 0.06 --How long it takes target the next humanoid
local DamageTime = 3 --How long it takes for the enemy to attack again
local Damage = 30 --How much damage the enemy does
--Advanced Config
local AgroDist = 101
local HitBox = script.Parent.HitBox
local Player = game.Players.LocalPlayer
local enhum = script.Parent.Enemy
local ddb = false
local character
while wait() do
local player = game.Players.LocalPlayer
for i, v in pairs(game.Players:GetChildren()) do
character = game.Workspace:WaitForChild(v.name)
if (character.Humanoid.RootPart.Position - enhum.RootPart.Position) <= AgroDist then
enhum:MoveTo(character.PrimaryPart.Position)
enhum.MoveToFinished:Wait(UpdatePosition)
end
end
What's wrong with my code?

1 comment
beginner mistake sorry, But Thanks! I have another error now but I can hopefully get help fixing that.