I have this running on RenderStepped. For some reason, even when I am close to a stand, it still prints ’ Too far’
I want the ‘NewStand’ function to only run when I am at a newer stand. Atm it continuously fires the function
local function RenderStepped()
local Character = Player.Character
if not Character then return end
local HumanoidRootPart = Character:FindFirstChild('HumanoidRootPart')
if not HumanoidRootPart then return end
for _, v in pairs(Stands:GetChildren()) do
local Distance = (v.PrimaryPart.Position - HumanoidRootPart.Position).Magnitude
if Distance < ReachableDistance then
if CurrentStand == v then return end
-- Set new stand
CurrentStand = v
else
print('Too far')
end
end
if not CurrentStand then return end
NewStand()
end