i am using .magnitude to check if a new building is in range of a structure
for some reason the distance value is way too high and it never changes when a new child is added
local connection
connection = workspace.Buildings.ChildAdded:Connect(function(v)
local dist = (v.PrimaryPart.Position - pylon.PrimaryPart.Position).Magnitude
print(dist)
if dist <= pylon.Config.Range.Value then
print("yeah")
if not table.find(buffed, v) and not v.HumanoidRootPart:FindFirstChild("BuffGui") then
table.insert(buffed, v)
local buffGui = ReplicatedStorage.BuffGui:Clone()
buffGui.Parent = v.HumanoidRootPart
buffGui.Buffs.cdBuff.Visible = true
buffGui.Buffs.damageBuff.Visible = true
buffGui.Buffs.rangeBuff.Visible = true
end
end
end)