Could someone help me fiox this scirpt, I don't know why its not working

Had to do a bit of research and it looks as if this is not possible when the CameraMinZoomDistance property is set so something larger than the current zoom distance, or is a bug which hasn’t been patched yet. It’s possible if you know how to script camera with CFrame. You can also bypass it by setting min zoom distance → max, and then min again. I did a bit of touching up with your script here which works for me:

local Players = game:GetService('Players')
local Player = Players.LocalPlayer

local UserInputService = game:GetService('UserInputService')

local shiftKeyR = Enum.KeyCode.RightShift

local function IsShiftKeyDown()
	return UserInputService:IsKeyDown(shiftKeyR)
end

local function Input(input, gameProcessedEvent)
	if not IsShiftKeyDown() then
		
	else
		if Player.CameraMaxZoomDistance == 10 then
			Player.CameraMaxZoomDistance = 0.5
			Player.CameraMinZoomDistance = 0.5
			Player.CameraMaxZoomDistance = 0.5
		else
			Player.CameraMaxZoomDistance = 10
			Player.CameraMinZoomDistance = 10
			Player.CameraMaxZoomDistance = 10
		end
	end
end

UserInputService.InputBegan:Connect(Input)