local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char.Humanoid
local t = char.Torso
char.BSFolder.BallCount.Value = char.BSFolder.BallCount.Value + 1
local ball = Instance.new("Part")
ball.FormFactor = "Custom"
ball.Shape = "Ball"
ball.BottomSurface = "Smooth"
ball.TopSurface = "Smooth"
ball.CanCollide = false
ball.Size = Vector3.new(0.5,0.5,0.5)
ball.BrickColor = BrickColor.new("Really black")
local subject = Instance.new("Part")
subject.Parent = t
subject.FormFactor = "Custom"
subject.CanCollide = false
subject.Size = Vector3.new(0.1,0.1,0.1)
subject.BrickColor = BrickColor.new("Really black")
ball.Parent = subject
local w = Instance.new("ManualWeld")
w.Name = "Weldy"
w.Parent = subject
w.Part0 = t
w.Part1 = subject
w.C0 = CFrame.new(0,0,0)
local w2 = Instance.new("ManualWeld")
w2.Name = "Weldy"
w2.Parent = ball
w2.Part0 = subject
w2.Part1 = ball
w2.C0 = CFrame.new(0,0,2.7)
-- //
for index, child in pairs(game:GetService("Players"):GetPlayers()) do
if child.Name ~= plr.Name then
print("Kappa1")
if (ball.Position - child.Character.Torso.Position).magnitude < 10 then
print("Kappa2")
local ray = Ray.new(ball.Position - child.Character.Torso).unit * 10
local ignore = game.Players.LocalPlayer.Character
local hit, position, normal = workspace:FindPartOnRay(ray, ignore)
end
end
end
-- //
--==========================================
local angle = 0
while true do
w.C0 = CFrame.new(0,0,0) * CFrame.Angles(0, angle, 0)
wait()
angle = angle + 0.1
end
--==========================================
I'm trying to get a raycast whenever a character that is not localplayer gets close to the "ball" part , which is rotating around the localplayer. And I can't get the magnitude to work.

5 comments
I'm assuming that it prints Kappa1?
It does.
Please provide some context to the problem and what errors you are getting and so forth. It's very confusing to everyone else because we don't know what we're trying to answer
There. I've specified what' s my issue.
If I helped, accept the answer so people know it's solved, por favor.