The title is a bit confusing, so I’ll try to make it more clear;
I’m trying to make it so a parts “exclamation mark” will appear on the compass above, and it will get less transparent as they get closer, here is what I want in screenshots if you are still a bit confused;
I want this;
to combine with this;
to make something like this;
basically I want the part is to appear on the compass-type thing.
Here is my compass script to help you incorporate it if you can;
--// VARIABLES
local Smoothness = 5/3
local Player = game.Players.LocalPlayer
local Camera = workspace.CurrentCamera
local Frame = script.Parent
local LastY = 0
local units = {
[Frame.N ] = -math.pi * 4/4;
[Frame.NE] = -math.pi * 3/4;
[Frame.E ] = -math.pi * 2/4;
[Frame.SE] = -math.pi * 1/4;
[Frame.S ] = math.pi * 0/4;
[Frame.SW] = math.pi * 1/4;
[Frame.W ] = math.pi * 2/4;
[Frame.NW] = math.pi * 3/4;
}
--// FUNCTIONS
function RestrictAngle(Angle)
if Angle < -math.pi then
return Angle + math.pi*2
elseif Angle > math.pi then
return Angle - math.pi*2
else
return Angle
end
end
while true do
local Delta = wait()
local Look = Camera.CoordinateFrame.lookVector
local Look = Vector3.new(Look.X, 0, Look.Z).Unit
local LookY = math.atan2(Look.Z, Look.X)
local DifferenceY = RestrictAngle(LookY - LastY)
LookY = RestrictAngle(LastY + DifferenceY*Delta*Smoothness)
LastY =LookY
for Unit, Rot in pairs(units) do
Rot = RestrictAngle(LookY - Rot)
if math.sin(Rot) > 0 then
local CosRot = math.cos(Rot)
local CosRot2 = CosRot*CosRot
Unit.Visible = true
Unit.Position = UDim2.new(0.5 + CosRot*0.6, Unit.Position.X.Offset, 0, 3)
else
Unit.Visible = false
end
end
end
any help is appreciated!