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?
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)
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 (: