What I’m trying to do Is make It so well the user holds down the Z key It will zoom In, similar to the Minecraft mod Optifine.
At first It was not working with no errors printed, so I added some print statements In the functions of which nothing was triggered upon testing. This also rules out the possibility of It just being something like the tween not working.
local uis = game:GetService("UserInputService")
local ts = game:GetService("TweenService")
uis.InputBegan:Connect(function(input)
if input.UserInputType == Enum.KeyCode.Z then
print("before tween")
local ti = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false)
local pt = {
FieldOfView = 30
}
local tween = ts:Create(game.Workspace.Camera, ti, pt)
tween:Play()
print("after tween")
end
end)
uis.InputEnded:Connect(function(input)
if input.UserInputType == Enum.KeyCode.Z then
print("end begin")
local ti = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false)
local pt = {
FieldOfView = 70
}
local tween = ts:Create(game.Workspace.Camera, ti, pt)
tween:Play()
print("end end")
end
end)