Moving a part relative to sphere

Oh cos hyperant does it. OK can I make the object face my mouse?

How do you want to make the object face the mouse?

Can I send you the rbxl file ?

The .rblx file of what? I don’t know what else you want to do.

My roblox project >> chrs luimit

Why do you want to send your roblox project? Is there anything else I can help you with?

My game project is very different from yours.

I provided you with the concept and a completed script, but I didn’t intend to be hired solely on that basis.

ok so can you tell me how to make it face the mouse click direction?

You just need to switch the second parameter of `lookAt()’ method.

local sphere = workspace.Sphere
local part = workspace.Part

local currentPosition = part.Position
local destination = getDestination()

local sub = destination - currentPosition
local sphereRay = sphere.Size.X / 2

local totalFramesCount = 100

for i=1, totalFramesCount do
    local newCFrame = CFrame.lookAt((((i / totalFramesCount) * sub + currentPosition) - sphere.Position).Unit * sphereRay + sphere.Position, destination)
    part.CFrame = newCFrame
    task.wait(0.015)
end


right now, my script stays flat but i cant make it lookat mouse position otherwise it just breaks

		local main = i:FindFirstChildOfClass("Model")

		local currentPosition = i.Position
		local destination = location.Position

		local sub = destination-currentPosition
		local sphereRay = workspace.Baseplate.Size.X/2 -- make sure that your sphere has the same X, Y and Z size values

		local totalFramesCount = 300
		
		for x=1, totalFramesCount do
			local newPosition = (((x/totalFramesCount*sub+currentPosition)-workspace.Baseplate.Position).Unit*sphereRay)+workspace.Baseplate.Position
			i.Position = newPosition
			local cf = CFrame.lookAt(i.Position,workspace.Baseplate.Position, (i.Position - workspace.Baseplate.Position).Unit) * CFrame.Angles(0, -math.pi/2, 0)

			main:SetPrimaryPartCFrame(cf)
			i.CFrame=cf
			task.wait() -- cooldown between frames
		end

I had an idea to use the CFrame.lookAt() method to make a part face its next waypoint. However, I encountered an issue when the part was positioned on the lower section of the sphere, as it appeared to be upside down, much like the popular “life in Australia” memes. Unfortunately, I am currently at a loss for alternative solutions to this problem.

1 Like