In the script I have made, it's supposed to lock the player camera zoom distance at 20, but for some reason it's not doing this.
local frame = script.Parent.Frame
local player = game.Players.LocalPlayer
local humanoid = player.Character:WaitForChild("Humanoid")
local cams = game.Workspace.cam
local anim = cams.librarycam.Humanoid:LoadAnimation(cams.librarycam.Animation)
player.PlayerGui.viewbobbing.Disabled = true
player.CameraMaxZoomDistance = 20
player.CameraMinZoomDistance = 20
frame.BackgroundTransparency = 0
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
player.Character.SprintScript.Disabled = false
script.Parent.lock:Play()
wait(.5)
local plrname = game.Workspace.interior.LibraryDoor.closed.whounlocked.Value
script.Parent.dialogue.Visible = true
wait(0.5)
script.Parent.ay:Play()
for i = 1,string.len(plrname.. " unlocked the library door."),1 do
script.Parent.dialogue.Text = string.sub(plrname.. " unlocked the library door.",1,i)
wait(0.02)
end
script.Parent.ay:Stop()
player.CameraMaxZoomDistance = 20
player.CameraMinZoomDistance = 20
wait(2)
frame.BackgroundTransparency = 1
script.Parent.dialogue.Visible = false
wait(.1)
script.Parent.Camera.Disabled = false
anim:Play()
print("animation played")
anim:AdjustSpeed(1)

3 comments
Try putting it in a loop?
You seem to be using it correctly. Does it run everything before that part of the code and everything after it? You could also try using StarterPlayer.CameraMinZoomDistance instead of the local player's
yes, it runs everything before and after the code. ill try those suggestions in a second.