Hello Fellow Developers!,
I have recently ran into an issue which i cant seem to find the solution to anywhere,
i will keep it short and simple,
i have a script in starter player scripts, which makes you zoom in/out when a key is pressed, the code works, only problem is that when the character first loads in, the script dosent seem to work, but after resetting the character it works always after that, and unfortuantly resetting that character isnt an option in the game im trying to create, if there is some way i could load the script without the character needing to be reset, please comment below. Any support is appricated
here is the code for the client script in starterplayerscripts
-- Client Script
local Player = game.Players.LocalPlayer
local FPVAL = script.InFP
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input,GameProcessed)
if not GameProcessed then
if input.KeyCode == Enum.KeyCode.V then
wait()
FPVAL.Value = not FPVAL.Value
if FPVAL.Value == true then
Player.CameraMaxZoomDistance = 0.5
Player.CameraMinZoomDistance = 0.5
elseif FPVAL.Value == false then
Player.CameraMaxZoomDistance = 14
Player.CameraMinZoomDistance = 14
end
wait()
end
end
end)
*note FPVAL is a Boolean value i have attached to the script to know if the player is in first pearson or not.
I made sure that the input wasn’t game processed so player wasn’t typing in chat and changing their FOV
Again any help is appricated and i am open to criticism.