You can write your topic however you want, but you need to answer these questions:
So about an hour ago I posted an unfinished version of this post and I feel really dumb. I was going to just edit it, but at this point no one would see it so I’m just reposting this.
So I wanted to have a ScreenGui behind a part, but that’s not possible as far as I’m aware so I just decided to use a BillboardGui and offset it using SizeOffset. The closest I’ve got so far is the top right corner being centered.
I’ve tried to add, subtract, multiply and divide the scale, but when I try it just gets worse.
Here’s the script:
local cam = workspace.CurrentCamera
local part = script.Parent.Adornee
screenX = 0
screenY = 0
-- BillboardGui is script.Parent
script.Parent.Parent:WaitForChild("ScreenSize").Changed:Connect(function(property)
if property == "AbsoluteSize" then
local screensize = script.Parent.Parent:WaitForChild("ScreenSize")
-- screensize is a ScreenGui in the player's gui
screenX = screensize.AbsoluteSize.X
screenY = screensize.AbsoluteSize.Y + 36
local newscale = UDim2.new(0, screensize.AbsoluteSize.X, 0, screensize.AbsoluteSize.Y + 36)
script.Parent.Size = newscale
end
end)
-- ignore this part
local screensize = script.Parent.Parent:WaitForChild("ScreenSize")
screenX = screensize.AbsoluteSize.X
screenY = screensize.AbsoluteSize.Y + 36
local newscale = UDim2.new(0, screensize.AbsoluteSize.X, 0, screensize.AbsoluteSize.Y + 36)
script.Parent.Size = newscale
cam.Changed:Connect(function(property)
if property == "CFrame" then
local billboardPosition = script.Parent.Adornee.Position
local vector = cam:WorldToViewportPoint(billboardPosition)
local scaleoffset = Vector2.new(vector.X / screenX, vector.Y / screenY)
scaleoffset = Vector2.new(scaleoffset.X * -1, scaleoffset.Y -1)
script.Parent.SizeOffset = scaleoffset
end
end)
I’m sorry if this post is bad I’m new to this.
