-
What do you want to achieve?
When the user walks close to the object, the print stuff gets executed. -
What is the issue?
Nothing happens, no errors, nothing to indicate anything wrong but the script clearly isn’t running. -
What solutions have you tried so far?
I couldn’t find anything related to my topic or my problem.
local plr = game:GetService("Players")
local obj = script.Parent
local localPlr = plr.LocalPlayer
local char = localPlr.Character or localPlr.CharacterAdded:Wait()
while true do
if (char.HumanoidRootPart.Position - obj.Position).Magnitude <= 5 then
print("If this prints then you're a genius bud")
end
wait(1)
end
Other information
- The object is a mesh, the localscript is inside the mesh
- changing the obj’s position in the if to
CFrame.Position
does not work either.