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

LOCKING PLAYER FOV, can someone help me?

im trying to lock the players FOV but it wont work D: help this script is a local script inside of a tool inside of starter pack

local cam = workspace.CurrentCamera
local playr = game.Players.LocalPlayer
cam.CameraSubject=playr.head
cam.CameraType = "Attach"

script.Parent.Parent.Parent.CameraMinZoomDistance = CameraMinZoomDistance.300
script.Parent.Parent.Parent.CameraMinZoomDistance = CameraMaxZoomDistance.300

why isnt it working?

1 answer

✓ Accepted answer

If you're just trying to change the FieldOfView, use this:

script.Parent.Equipped:connect(function()
	workspace.CurrentCamera.FieldOfView = Put what FOV you want here
end)

Change script.Parent to script.Parent.Parent if you put the script in the tool's handle.

If you're not familiar with the Equipped event, you can find it here: http://wiki.roblox.com/index.php?title=API:Class/Tool/Equipped

If you want to change the FOV when they unequip the tool, just take the function and change Equipped to Unequipped and set the FOV to whatever you want it to be when the tool is unequipped.

Also in line 3, you can't use playr.head because you're inside of the player not the player's character. To get the character, all you have to do is use playr.Character. In lines 6 and 7, if you want to change the game's default min and max zoom distance, you can change them in StarterPlayer. There's a section named Camera.

1 comment

0

thanks

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