Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How would I identify a Players current Position inside of a Circle?

Asked by
Ziffixture 6913 Moderation Voter Community Moderator
5 years ago

I am trying to make a Circle that appears below the Characters feet, acting as a perimeter surrounding the Player. Anyone to step anywhere past the Circumference of the Circle will have their current location tracked. I would like to return their distance from the Center of the Circle, Circumference and CFrame. I'm not entirely sure whether it's best to use the HumanoidRootPart as the Centerpoint, but if so then that's fine. I'm not sure how to do this, could anyone help me? I also have one other Circumference calculation that acts as a halfway point, the idea of this function is to hurt the Player at a higher rate the close they are.

game.Players.PlayerAdded:Connect(function(pl)
   local ch = pl.Character
   math.randomseed(tick())
   if (ch) then
      local camera = workspace.CurrentCamera
      local fov = math.clamp(math.ceil(camera.FieldOfView/2)), 25, 45)
      local pi = 3.14
      local di = math.random(25, fov)
      local ra = (d/2)
      local ci = 2(pi)ra
      local cir = Instance.new("Part"); cir.Parent = ch
   end
end

This is the basic idea of what I have, also, for a Weld, how would I have it stay on the Ground, and not angle if you jump as R15?

1 answer

Log in to vote
1
Answered by 5 years ago

I can't answer your question entirely but i assure you that using this following distance calculation could help you alot:

(part1.Position - part2.Position).magnitude -- Distance between two points
Ad

Answer this question