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)
Try 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 = 6 wait() player.CameraMinZoomDistance = 19 player.CameraMaxZoomDistance = 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 = 6 wait() player.CameraMinZoomDistance = 19 player.CameraMaxZoomDistance = 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)