local ContextService = game:GetService("ContextActionService")
local RunService = game:GetService('RunService')
local Player = game:GetService('Players').LocalPlayer
local Camera = workspace.CurrentCamera
local Mouse = Player:GetMouse()
Camera.CameraType = 'Scriptable'
local Target = workspace:WaitForChild('Part')
local RightHolding = false
local Dampining = 0.01
local Direction = 1
local Index = 0
local function RightChanged(ActionName, ActionInputState, ActionInputObject)
if ActionInputState == Enum.UserInputState.End then
RightHolding = false
elseif ActionInputState == Enum.UserInputState.Begin then
RightHolding = true
end
end
local DeltaMouse = 0
local LastMouse = 0
RunService.RenderStepped:connect(function()
DeltaMouse, LastMouse = LastMouse - Mouse.X, Mouse.X
local OldIndex = Index
if RightHolding then
Index = Index + (DeltaMouse * 0.005)
if Index > OldIndex then
Direction = 1
elseif Index < OldIndex then
Direction = -1
end
end
Index = Index + (Dampining * Direction)
Camera.CFrame = CFrame.new(Target.Position)
* CFrame.Angles(0, Index, 0)
* CFrame.new(0, 2.5, 4.5)
* CFrame.Angles(math.rad(-20), 0, 0)
end)
ContextService:BindAction("RightChanged", RightChanged, false, Enum.UserInputType.MouseButton2)
smite me down god |