Is it possible to make the billboard gui stay on a players screen? The gui is on a part, what I’m aiming for is that when the player turns away from the part, the GUI stays on screen on the side or in a corner?
this might be the wrong place, but I assume this is a thing that needs to be done with scripts
I am not sure how to implement it exactly, but you will need two different kinds of GUIs to have something like this to work: ScreenGui and BillboardGui. You will also need to know the orientation of the player’s camera, along with the object’s relative position from the player, as you can use those two things to determine whether or not something is on screen. There might be a much better way of doing this, but those are my two cents.
I believe this might keep at least part of it on the screen. I’m not sure though. I have never used bilboardguis.
local RunService = game:GetService("RunService")
local guiObj = -- bilboardgui
local cam = workspace.CurrentCamera
local adorn = guiObj.Adornee
local fovTan = math.tan(cam.FieldOfView)
local screenSize = camera.ViewportSize
local aspectRatio = screenSize.X/screenSize.Y
local function updatePos()
local camCf = cam.CFrame
local adornPos = adorn.Position
local relOffset = camCf:PointToObjectSpace(adornPos)
local relZ = relOffset.Z
local maxRelY = -fovTan*relZ
local maxRelX = maxRelY*aspectRatio
clampedRelOffset = Vector3.new(
math.clamp(relOffset.X, -maxRelX, maxRelX)
relZ < 0 and math.clamp(relOffset.Y, -maxRelY, maxRelY) or -maxRelY
rellOffset.Z
)
local clampedPos = camCf*clampedRelOffset
guiObj.ExtentsOffset = clampedPos-adornPos
end
RunService.RenderStepped:Connect(updatePos)
This will end up moving the Billboard-GUI away from its original location though. So that when you pan your screen back to where the billboard gui should be, it would appear in a different location, depending on how you moved your camera.
I think what he wants is for the gui to always appear on the edges of the screen if his camera is no longer viewing the gui. Of course on which edge it will be on and how it will be positioned on that edge is important.