Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

2 comments

0

It didn't work, when i zoom out or zoom in still the GUI doesn't fill it.

0

Nevermind, i've found that u can adjust it in StarterPlayer, but anyways thank you for atleat answering c:

This discussion is preserved as it was. New answers, comments, and votes are closed.