Camera Toggler

local TEMPLATE_ROOT = script:GetCustomProperty("TemplateRoot"):WaitForObject()
local CAMERA = script:GetCustomProperty("Camera"):WaitForObject()

local BINDING = TEMPLATE_ROOT:GetCustomProperty("Binding")

local LOCAL_PLAYER = Game.GetLocalPlayer()

function OnBindingPressed(player, binding)
    if binding == BINDING then
        player:SetOverrideCamera(CAMERA)
    end
end

function OnBindingReleased(player, binding)
    if binding == BINDING then
        player:ClearOverrideCamera()
    end
end

LOCAL_PLAYER.bindingPressedEvent:Connect(OnBindingPressed)
LOCAL_PLAYER.bindingReleasedEvent:Connect(OnBindingReleased)

Latest Posts