Menu Buttons follow Mouse

Hello everyone, I saw this effect on a popular game (The Mimic), and I wanted to recreate it (The menu buttons following mouse). Although, I am not that good with coding and I was wondering how I could make this

EFFECT:

How would I go along with this?

I’ve thought of:

  • coding it in StarterGui with the GetMouse thingy
  • or I could make a BillBoardGui and put my buttons there.

If anyone can help me recreate the movement shown in the video, that would be greatly appreciated. Thank you!

SurfaceGui on parts and thats how you do it

I tried it and it didn’t really have the same effect, although it was close.
How would you make the parts always face the camera?

Try checking this out:

What the code is doing is receiving the magnitude between the midpoint of the game window size and the mouse position relative, and rotating the camera according to the magnitude received.

Wait, are you trying to recreate the camera follow mouse?

Rather than code this up, let me explain it and break it down. The camera has been put in a live place in the game with a GUI overlaid on the screen. When the mouse moves, both the camera and the GUI shift slightly to create the motion effect. You probably know this much already. So, how is this done…

The menu on the left is a ScreenGui with a transparent background so just the text shows. The workspace.Camera is set to Enum.CameraType.Scriptable and it’s CFrame is set to that it is sitting in this field in front of this box. The Camera Subject is set to something in the distance, probably one of the doors to the tent which causes the camera to always point toward those doors.

The mouse is tracked via UserInputService:InputChanged. Here is an example in the docs: UserInputService | Roblox Creator Documentation

Screen size is necessary to know relative position of the mouse in teh screen. Screen size is obtained via the Camera.ViewportSize.

As the mouse moves from the center of the screen, the camera is nudged slightly in the same direction by adjusting its CFrame while the ScreenGui is nudged in the opposite direction be adjusting its Position offsets. A polynomial function can be used if you want the shift to be non-linear.

It’s a nice effect and the setting is really nice as well. Very well done in that game.

oh no, I already did that. I want to recreate the movement of the menu buttons based on where the mouse is

Billboard gui then i guess? It already rotates based on camera

I’ll try that out. Thank you! only here to exceed text limit

I’ll try my best to code that, thank you for the info!

This might help if you want to do it with a gui, Billboard gui is probably best but this might work

I’ll test it out when I can, thanks! :slight_smile:

1 Like