Log in to vote

Key to Show Menu and Change CameraMaxZoom?

Asked by 13 days ago

Hey I wanted to do a script which changes the CameraMaxZoom so it goes out. It is 0.5 at the start but at the menu its 128. I made a button to change it to 0.5 (at the start). The key makes it change to 128 but the problem is it still changes to 0.5. I would like to know what is the problem I have done. To just let you know: The GUI shows when I click M. Then it closes when I click M. That is what I wanted but its still on 0.5 meaning the person cant move there cursor.


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

local Mouse = Player:GetMouse()
local Gui = script.Parent
local Open = false

function PressM(key)
    if (key == "m") then
        if (Open == false) then
            Gui.Enabled = true
            game.StarterPlayer.CameraMaxZoomDistance = 128
            Open = true
        elseif (Open == true) then
            Gui.Enabled = false
            game.StarterPlayer.CameraMaxZoomDistance = 0.5
            Open = false


Answer this question