How to force player to only move left and right in radius?

I’m currently wondering how you could allow a player to move in a specific orbit only? (red cylinder part is supposed to illustrate where you could move using the keys “A (left)” and “D (right)”.

I’m not sure how to go on about this and I would appreciate what I could potentially do to achieve this.

Example of what I want to achieve:

image

1 Like

Use this post to get you on your way:

From post #8, just change angleAmount as the player presses the specified keys.

Edit: Also don’t forget to disable the keys you need to!

1 Like

I’m trying to figure out how to use it before I implement key control. It doesn’t work as intended. I’m not sure what I am doing wrong.

Server Script:

local RunService = game:GetService("RunService")
local Circle = game.Workspace.Cylinder

RunService.Heartbeat:Connect(function()
	for i,v in pairs(game.Players:GetPlayers()) do
		local angleAmount = math.pi*2/#game.Players:GetPlayers()
		local multiplier = 3
		local yValue = 2
		local pos = Vector3.new(math.sin(angleAmount*i)*multiplier, yValue, math.cos(angleAmount*i)*multiplier) + Circle.Position
		v.Character:MoveTo(pos)
	end
end)

Can you describe the issue? If you’re getting an error saying you can’t “attempt to index nil with ‘MoveTo’”, it’s because you need to check to see if the character loaded.