I have a script that tweens and sets the FOV, however once the tween finished it resets back to the default. I have a render stepped loop setting the FOV, and the print statement inside say the FOV is 45, but when I check it in the explorer, it is the default 60 again. I have no idea why this is happening.
I tried to achieve what you wanted, and it does works:
local plr = game.Players.LocalPlayer
local char = plr.Character
local cam = workspace.CurrentCamera
local uis = game:GetService("UserInputService")
local ts = game:GetService("TweenService")
uis.InputBegan:Connect(function(input,gpe)
if gpe then return end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
ts:Create(cam,TweenInfo.new(.25),{FieldOfView = 45}):Play()
end
end)
uis.InputEnded:Connect(function(input,gpe)
if gpe then return end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
ts:Create(cam,TweenInfo.new(.25),{FieldOfView = 70}):Play()
end
end)
Video:
I think the issue in your code is that, using a RenderStep connection, the FieldOfView value is getting overrided right after the tween is being executed.
You don’t need to refresh the FOV value each frames.
Tell me if it’s not what you wanted to achieve.
I appreciate the help, I’ll test the solution when I get home. I used the renderstepped thing to attempt to fix my issue in the beginning, so it wasn’t the cause. I’m working on someone else’s script so i’ll just re do what i have with yours. Thanks
I used here the game processing event so the input isn’t firing when the player input state isn’t focusing on the game. I’m mostly pointing at when the player is using the chat, but yes, in the case of the mouse, it’s indeed kind of useless.