Some code: want to know if its efficient
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local Lighting = game:GetService("Lighting")
local HttpService = game:GetService("HttpService")
local CurrentCamera = workspace.CurrentCamera
local Antithetical, Dampener = 1, 2.5
local PreviousLookVector = CurrentCamera.CFrame.LookVector
local MinimumBlurEffect, MaximumBlurEffect = 18, 24
local TweenInfoNew = TweenInfo.new(
.5,
Enum.EasingStyle.Sine,
Enum.EasingDirection.InOut,
0,
false,
0
)
function DegreesTowardsDot(Theta)
return math.cos(math.rad(Theta))
end
local BlurEffectTable = {}
local BlurEffect = nil
RunService.RenderStepped:Connect(function()
if not Lighting:FindFirstChildOfClass("BlurEffect") then
BlurEffect = Instance.new("BlurEffect")
BlurEffect.Name = BlurEffectTable[#BlurEffectTable - #BlurEffectTable + 1] or HttpService:GenerateGUID()
BlurEffect.Size = 0
BlurEffect.Parent = Lighting
table.insert(BlurEffectTable, BlurEffect.Name)
end
if Antithetical % Dampener == 0 and BlurEffect ~= nil then
local Dot = PreviousLookVector:Dot(CurrentCamera.CFrame.LookVector)
if Dot >= DegreesTowardsDot(MinimumBlurEffect) then
TweenService:Create(BlurEffect, TweenInfoNew, {Size = 0}):Play()
elseif Dot < DegreesTowardsDot(MinimumBlurEffect) then
local Equation = (1 - Dot) * MaximumBlurEffect
TweenService:Create(BlurEffect, TweenInfoNew, {Size = Equation}):Play()
end
end
PreviousLookVector = CurrentCamera.CFrame.LookVector
Antithetical += 1
end)
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local LocalPlayerCharacter = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local LocalPlayerHumanoid = LocalPlayerCharacter:WaitForChild("Humanoid")
local NormalFieldOfView, SprintFieldOfView = 70, 82.5
local NormalWalkSpeed, SprintWalkSpeed = 16, LocalPlayerHumanoid.WalkSpeed * 1.5
local LocalPlayerSprinting = false
UserInputService.InputBegan:Connect(function(InputBegan)
if InputBegan.KeyCode == Enum.KeyCode.LeftShift then
TweenService:Create(CurrentCamera, TweenInfoNew, {FieldOfView = SprintFieldOfView}):Play()
TweenService:Create(LocalPlayerHumanoid, TweenInfoNew, {WalkSpeed = SprintWalkSpeed}):Play()
LocalPlayerSprinting = true
end
end)
UserInputService.InputEnded:Connect(function(InputEnded)
if InputEnded.KeyCode == Enum.KeyCode.LeftShift then
TweenService:Create(CurrentCamera, TweenInfoNew, {FieldOfView = NormalFieldOfView}):Play()
TweenService:Create(LocalPlayerHumanoid, TweenInfoNew, {WalkSpeed = NormalWalkSpeed}):Play()
LocalPlayerSprinting = false
end
end)
```