How do i make a tower script where if it only shoots the target has a higher value and a lower value?

So my zombies have a system where it has a movingvalue and a magnitude value,the movingvalue is the highest and the magnitude value must be lowest, that makes it first.

How do i make a humanoid shoot it if one is in range and has these values?

if target then
    if target.MovingValue.Value >= 5 and target.Magnitude.Value <= 2 then
        -- Do something
    end
end

The code checks to see if there is a target, and if there is, it checks to see if the target has a moving value of 5 or higher and a magnitude of 2 or lower. If both of those conditions are met, it does something.

and uhh… somehow, how do i get the target to work on.

It looks like you’re trying to take the magnitude and direction of a Part’s velocity and compare it against a certain value and another certain value.
For that, you can simply use the Velocity property.

local velocity = part.Velocity
local magnitude = velocity.magnitude
local direction = velocity.unit

Now, you can use this in your code to find out the correct values.

-- This will be the value of magnitude that it would need to be to reach this
-- velocity.
local targetMagnitude = 5

-- This is the value of magnitude that it would need to be to go in the 
-- opposite direction.
local maxMagnitude = 2

-- This is the current magnitude of the velocity.
-- If the velocity is a vector of 0, this will return 0.
local magnitude = velocity.magnitude

if targetMagnitude <= magnitude and magnitude <= maxMagnitude then
    -- Do something
end

yeah but how do i make it run in a specific folder, where it has the enemies inside.

so if in range they do something like print or start a script or something