I want to achieve a smooth zoom in and out when pressing I and O.
I have no idea how to start on this, and I don’t want to be stuck with this: https://gyazo.com/4bfc454098b9e803c7c5ecb07078a0dc
Just tween the CameraViewDistance
local LocalPlayer = game.Players.LocalPlayer
local ts = game:GetService("TweenService")
local function TweenCamViewDist(value, speed)
local tween_info = TweenInfo.new(speed, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tween = ts:Create(LocalPlayer, tween_info, {CameraViewDistance = value})
tween:Play()
end
Okay but I want to replace the current zooming in and out, I know how to use tweens, don’t know how to make a zooming in and out feature really
Are you trying to make a custom camera system?
Just a smooth zooming in and out which replaces the roblox one
Just use UserInputService, detect key, then just use my script as a result. Do you know how to remove the roblox zoom?
I do not know how to replace the roblox zoom one.
This should help you disabling those
for _ = 1, 2 do
while true do
local info = ActionS:GetBoundActionInfo("RbxCameraKeypress")
if info and info.inputTypes then
ActionS:UnbindAction("RbxCameraKeypress")
break
else
wait()
end
end
end
I used both variants, but I can still use the scrollwheel to move my camera.
If you want to disable, I have two ways.
local UserInputService = game:GetService('UserInputService')
UserInputService.InputChanged:connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseWheel then
local result = input.Position.Z > 0
end
end)
You can also use ContextActionService
ContextActionService and returning a sink
ContextActionService:BindAction(
"Action",
function ()
return Enum.ContextActionResult.Sink
end,
false,
Enum.UserInputType.MouseWheel
)
If you’re trying to replace, I don’t think it’s possible and I don’t know if there any other ways because unbinding the action won’t work (Assumption)
Complicated thing to do is to make a custom camera system which functions the same as the Roblox camera.
Couldn’t I rebind the keys with a greater priority for the different zoom?
Also, unbinding the keys actually gave a smooth zoom for I and O, but not for mousewheel
https://gyazo.com/a3375656c9199ea11d8a958715a3aa4a
I think you can, try doing that.