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

Player can zoom out even though camera mode is set to first person?

Asked by 3 years ago

I'm making a third person shooter and have it so that when the player aims by pressing RMB, the perspective switches to first person. I achieve this by doing:

UserInputService.InputBegan:Connect(function (input, gameHandledEvent)
    if gameHandledEvent or not ExpectingInput then
        return
    end

    if input.UserInputType == Enum.UserInputType.MouseButton2 and Mouse ~= nil then
        Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
    end
end)

UserInputService.InputEnded:Connect(function (input, gameHandledEvent)
    if gameHandledEvent or not ExpectingInput then
        return
    end

    if input.UserInputType == Enum.UserInputType.MouseButton2 and Mouse ~= nil then
    Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
end)

While the player is zoomed in, they can still zoom out by using the mouse wheel. How do I fix this?

1
You could try to change the player's maxzoom? That might be a solution. minerpepper 18 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Simply put the player's maxzoom to "0", u dont need any scripts, that's what I did for my game.

Ad

Answer this question