for i, v in pairs(game.Workspace:GetChildren()) do
local v = (v: IsA("Model") and v) or nil
if Character and v:FindFirstChild("HumanoidRootPart") and (Character.HumanoidRootPart.Position - v.HumanoidRootPart.Position).magnitude <= range then
I am very new to scripting, this is a portion of my combat script.

3 comments
Can you please show us the whole script?
Are you trying to get the distance between a player and a npc?
@Official_DuckyYT I cannot post it as it is too long