Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Anti-Zoom script which doesn't fill whole screen with GUI ?

Asked by
Bulvyte 388 Moderation Voter
9 years ago

So i've got this anti zoom script which doesnt let player zoom out within radius. And also whenever it does that it's guy doesnt fill the whole screen i tried adjusting gui's size heres how it looks: http://prntscr.com/86fj5l i've marked the area with yellow color.

Heres the local script

wait(0.1)
local maxZoom = 50
local cam = game.Workspace.CurrentCamera
local player = game.Players:GetPlayerFromCharacter(script.Parent)
local gui
while (not gui) do gui = script:findFirstChild("CamGui") wait() end
gui.Parent = player.PlayerGui

function loop()
    while ((player.Character) and (player.Character:findFirstChild("Head"))) do
        local dist = (cam.CoordinateFrame.p-player.Character.Head.Position).magnitude
        gui.Screen.Visible = (dist > maxZoom)
        wait(0.2)
    end
end

loop()

1 answer

Log in to vote
0
Answered by 9 years ago

Problem There is much more efficient ways of doing this, no idea how a gui does that anyways

Solution Put this in a localscript inside the starterpack

repeat wait() until game.Players.LocalPlayer.Character
local player = game.Players.LocalPlayer.Character
local mindist = 10
local maxdist = 20

player.CameraMinZoomDistance = mindist
player.CameraMaxZoomDistance = maxdist
0
It didn't work, when i zoom out or zoom in still the GUI doesn't fill it. Bulvyte 388 — 9y
0
Nevermind, i've found that u can adjust it in StarterPlayer, but anyways thank you for atleat answering c: Bulvyte 388 — 9y
Ad

Answer this question