Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Changing Camera Zoom Distance not working?

Asked by 3 years ago

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)
0
Try putting it in a loop? nekosiwifi 398 — 3y
0
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 blowup999 659 — 3y
0
yes, it runs everything before and after the code. ill try those suggestions in a second. flufffybuns 89 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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)
Ad

Answer this question