So i'm trying to make a explosion of confetti when you buy something and to make it go over the guis I need to turn the gui into a surface gui that is right in-front of the camera. However what if the player is playing on a massive screen or a tiny one.. How do I get the size of the camera in studs.. I have tried to get pixels to studs but there is no accurate way to do that..
Heres my code but as you can see the part becomes WAY to big.
script.Parent.TextButton.MouseButton1Click:connect(function()
local studsizeX = game.Workspace.CurrentCamera.ViewportSize.X/13
local studsizeY = game.Workspace.CurrentCamera.ViewportSize.Y/13
local part1 = workspace.CamPart
local part2 = workspace.CamPart2
part1.Size = Vector3.new(studsizeX,studsizeY,1)
part2.Size = Vector3.new(studsizeX,studsizeY,1.1)
local Camera = game.Workspace.CurrentCamera
part1.CFrame = Camera.CFrame + Camera.CFrame.LookVector * Vector3.new(0,0,0.5)
part2.CFrame = Camera.CFrame + Camera.CFrame.LookVector * Vector3.new(0,0,0.45)
script.Parent.Enabled = false
for i,x in pairs(script.Parent:GetChildren()) do
x:Clone().Parent = workspace.CamPart.SurfaceGui
end
wait(0.2)
for i,x in pairs(workspace.CamPart2:GetChildren()) do
x.Enabled = true
end
wait(0.4)
for i,x in pairs(workspace.CamPart2:GetChildren()) do
x.Enabled = false
end
end)
