I am trying to position the players on the ends of the circle. The first player gets positioned correctly but I want the second player to be a little distant from the other player. The players end up being teleported in a line crossing the circle instead of all around the circle. How would I achieve this?
for i,v in pairs(_G.Players) do
local R = 14
local Rot = chairs.Circle.CFrame
Rot = Rot * CFrame.Angles(0,math.rad((360/#game.Players:GetPlayers())*i),0)
Rot = Rot * CFrame.new(0,1,R)
v.Character:MoveTo(R.p)
end
Couldn’t you just make a bunch of parts and group them, name them something like teleport1 teleport2 etc position them accordingly around the circle and then loop through them all I feel like that would be easier.
I would use math.tan.
Here’s a bit of pseudo-code to get you on your way.
for i, the players in the game do
angleAmount = math.pi*2/#players
movePlayer to (math.tan(angleAmount*i)*multiplier, yValue, 1*multiplier) + circleCenterPosition
end
I think this will work, but I haven’t tested it in real code.
Edit: this won’t work as written. I think I’m on the right track with math.tan, so I’ll keep updating this until a solution is found.
Alright, here’s a completely new reply. I was kind of on the right track with math.tan, but other trigonometry functions are needed.
for i, the players in the game do
angleAmount = math.pi*2/#players
movePlayer to (math.sin(angleAmount*i)*multiplier, yValue, math.cos(angleAmount*i)*multiplier) + circleCenterPosition
end