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

How do i make the Camera zoom distance properties work?

http://wiki.roblox.com/index.php?title=API:Class/Player/CameraMinZoomDistance http://wiki.roblox.com/index.php?title=API:Class/Player/CameraMaxZoomDistance

So i tried setting both those in a server script and a local script but it doesn't really work, is there something i'm doing wrong?

Thanks.

edit, heres the script:

game.Players.PlayerAdded:connect(function(Player)
Player.CameraMaxZoomDistance = 50			
Player.CameraMinZoomDistance = 50	
Player.NameDisplayDistance = 0	
end)

3 comments

0

Can you include the script you used.

0

game.Players.PlayerAdded:connect(function(Player) Player.CameraMaxZoomDistance = 50 Player.CameraMinZoomDistance = 50 Player.NameDisplayDistance = 0 end)

0

oops, updated the post instead

2 answers

Put a LOCAL SCRIPT in StarterCharacterScripts , in the local script put the following:

local hum = script.Parent:WaitForChild("Humanoid")
local plr = game:GetService("Players").LocalPlayer
plr.CameraMaxZoomDistance = 50
plr.CameraMinZoomDistance = 50
hum.NameDisplayDistance = 0

1 comment

0

+1, but it should be "script.Parent", and it would be better to call it "plr" not "Plr" to be consistent (in terms of capitalization style)

The server never manages GUIs nor cameras, so whenever you're working with either you should always use a LocalScript.

When you're in a LocalScript, you don't want to use PlayerAdded to try to get the current player, since the LocalPlayer was already added by the time the script runs. Instead, simply use game.Players.LocalPlayer (or game:GetService("Players").LocalPlayer)

2 comments

0

the problem wasn't that, i've clearly stated i both tried server script and local script, none worked, not even setting the properties in starterplayer, it was because the cameratype was set to Follow. Yup.

0

I should have mentioned: I was explaining some of your mistakes, not providing an answer (as abnotaddable had already done that). Good that you got it figured out, anyway

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