How to make a part point at the mouse constantly

I need help on how to make the part look at the mouse i want it to just constantly face the mouse but this doesn’t work any help?
image

1 Like

You’re not accessing the players mouse, You need to access it through player:GetMouse()

1 Like

theres a local script that defines the mouse and sends it over via mouse.hit

1 Like

Does it not rotatate, or something like that? I would also try to change up the while loop

while task.wait() do
MagicCircle.CFrame = CFrame.lookAt(MagicCircle.CFrame, Mouse)
end

EDIT: Or use a renderStepped function

1 Like

okay i will try this out and see if it works

i got this error
image
and im just trying to get it to constantly rotate towards to the mouse

This is supposed to be MagicCircle.CFrame = CFrame.lookAt(MagicCircle.Position, Mouse) like it was in the original post.

Could you describe or attach a picture of what happens when you run your current code?

1 Like

when i activate the remote event it just creates the magic circle and it sits above the character but doesn’t constantly look at the mouse
image

2 Likes

Are you firing the RemoteEvent to the server repeatedly or just once?

If its just once then the part is probably just looking at the position you sent instead of updating with your current mouse position as well.

1 Like

I think he’s using a while loop but using RunService could be better

1 Like

If you’re referring to the code in the original post, that is from a server script. We haven’t seen the local script yet so I am just asking about that.

1 Like

He shouldn’t need to fire it more than once, if he’s using a while loop that can use up a lot of memory. If you fire it more than once.

1 Like

image
this is the local script

yeah the only thing wrong is that the script inside the while loop doesn’t work

This code just sends the mouse’s position once at the time of the tool being activated, so it won’t update the mouse’s position on the server past the event firing. You have to update the mouse’s position on the server for the part to follow the mouse.

Since you would need to use a while loop on the local script for that anyways you should probably get rid of the while loop on the server.

2 Likes

alright im going to try that and see if it works

wow thanks it actually works correctly yeah the mouse pos just wasn’t saving
only issue is the circle is not facing it correctly but it works so thats just somthing for me to figure out

1 Like