I’m writing a script that launches an object far away from the player’s character and after it’s out of range, it despawns. How do I check whether the object’s out of range of the player?
I tried
local Distance2 = (HumanoidRootPart.Position - Mjolnir.Position).Magnitude
if Distance2 > 15 then
Debris:AddItem(Mjolnir)
end
to calculate the distance and destroy the object but it doesn’t work, what did I do wrongly?