How can I make a compass GUI?

How can I make a compass when the player moves it rotates like in call of duty as shown below⬇️


Here is a close-up
image

4 Likes

Here is a video that you can use, Its not in English but there’s a model that you can use. It’s not a perfect Compass, but you maybe able to tweak the script to make it more smooth.

4 Likes

The rotation would be very tricky with GUIs in ROBLOX, since ClipsDescendants doesn’t work with rotation or images.

You could make a square one that doesn’t rotate pretty easily.

But maybe you could get away with a cylinder-shaped part with a Texture on the round face, and then put that whole thing inside a ViewportFrame? Slide the texture around with Texture.OffsetStudsV/U and rotate it by rotating the cylinder? That might work?

4 Likes

@nicemike40 I think they mean just the compass bar at the top of the screen since they showed a close up below the main image.

4 Likes

Thankyou for the video, yeah when it comes to something heavily math related even though I’ve been scripting almost 4 years I just use source code and edit it like I made it render stepped and left it alone and it looks good thankyou.

For anyone seeing this that video has the model you can get from the toolbox and if you want to make it more smooth change the “While Loop” to render stepped and the first argument of renderstepped is the “step” argument basically what frame you are on per second and you can change the “delta” variable he has to “step” from render stepped and you have the perfect compass that you can modify looks or script wise as smooth as it can get

The Rotation you would get is:

math.deg(math.atan2(workspace.CurrentCamera.CFrame.LookVector.X, workspace.CurrentCamera.CFrame.LookVector.Y))

I’m not sure how well this works currently but you can inspect its scripts by typing the following in studio’s command bar.

game:GetService("InsertService"):LoadAsset(14864611).Parent = workspace