Hi developers!
Today I was trying to make the camera FOV tween on part touch and tween back when clicked X button. I tried but it doesn’t seem to work, also there are no errors in the output.
here is the script:
local blur = Instance.new("BlurEffect",game.Workspace.CurrentCamera)
blur.Size = 0
local Frame = script.Parent
local XButton = script.Parent.X
local BlackUI = script.Parent.Parent.BlackUI
local camera = workspace.CurrentCamera
local ts = game:GetService("TweenService")
local blackUiin = ts:Create(BlackUI, TweenInfo.new(1.1, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut), {BackgroundTransparency = 0})
local blackUiout = ts:Create(BlackUI, TweenInfo.new(1.1, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut), {BackgroundTransparency = 1})
local ti = TweenInfo.new(0.7, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local normalFOV, shopFOV = 70, 100
local normalTween = ts:Create(camera, ti, {FieldOfView = normalFOV})
local shopTween = ts:Create(camera, ti, {FieldOfView = shopFOV})
local Opened = false
game.ReplicatedStorage.GuiUp.OnClientEvent:Connect(function()
if not Opened then
Opened = true
shopTween:Play()
wait(0.8)
blackUiin:Play()
wait(1.2)
blackUiout:Play()
Frame:TweenPosition(UDim2.new(0.5, 0,0.5, 0),"Out","Quint", 1, true)
for i = 0,10,1 do
wait()
blur.Size = 24
end
end
end)
XButton.MouseButton1Click:Connect(function()
if Opened then
Opened = false
normalFOV:Play()
wait(0.8)
blackUiin:Play()
wait(1.2)
blackUiout:Play()
Frame:TweenPosition(UDim2.new(0.5, 0,3, 0),"Out","Quint", 1, true)
for i = 10,0,-1 do
wait(0.09)
blur.Size = 0
end
end
end)
good day