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

Can't chance Camera max zoom distance chance on death, any suggestions?

Asked by
n_ubo 29
5 years ago
Edited 5 years ago

Creating a cool fps game and discovered a bug where the camera's max zoom distance won't go back to 20 after you click the deploy button in the loadout selection which chances it to 0. but I just don't know how to make a script whit a dead function in it that activates the thing that the camera mode changes to 20 so it will save that on the next respawn so that PC gamers can interact whit the loadout screen again. Because PC users can not interact whit the GUI when fully zoomed in. What I want is that when you die, the max zoom distance goes to 20 before respawned so it saves that in order to interact whit the GUI on respawn.

Heres the code I made but just doesn't seem to work:

game.Players.LocalPlayer.died:connect(function(ondeath)
    game.Players.LocalPlayer.Cameramaxzoomdistance = 20

end)

    --maybe to simple?
0
i fixed it n_ubo 29 — 5y

2 answers

Log in to vote
0
Answered by
harstud 218 Moderation Voter
5 years ago

Welcome to scriptinghelpers. Here's a answer that should fix your problem. Make sure it's a localscript.

local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

Humanoid.Died:Connect(function(ondeath)
    game.Workspace.CurrentCamera.FieldOfView = 20
end)
Ad
Log in to vote
1
Answered by
n_ubo 29
5 years ago

game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function() game.Players.LocalPlayer.CameraMaxZoomDistance = 20 game.Players.LocalPlayer.CameraMinZoomDistance = 20 end)

this in a localscript in startercharacter scripts. and work. i fixed it from the discord but yours works to! thank you all (:

Answer this question