Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local p = game.Players.LocalPlayer
- local lastpos = Vector3.new(0,0,0)
- local serv = game:GetService("UserInputService")
- local mouse = p:GetMouse()
- local sens = 2
- local lastrot = Vector3.new(0,0,0)
- local lasttick = 0
- local db = false
- local CameraTurning = true
- local paused = false
- local saveVel = Vector3.new(0,0,0)
- local icon
- if p then
- function eq()
- icon = script.Parent.crosshair:Clone()
- icon.Parent = p.PlayerGui
- serv.MouseIconEnabled = false
- local cam = workspace.CurrentCamera
- cam.CameraType = Enum.CameraType.Attach
- local run
- local c = p.Character
- if c then
- local all = c:GetChildren()
- for i = 1,#all do
- if all[i].ClassName == "Part" and all[i].Name~="HumanoidRootPart" then
- all[i].Transparency = 0.7
- else
- if all[i].ClassName == "Accessory" then
- local find = all[i]:FindFirstChildOfClass("Part")
- if find then
- find.Transparency = 0.7
- end
- end
- end
- end
- end
- cam.CFrame = CFrame.new(c.Head.Position,(c.PrimaryPart.CFrame*CFrame.new(0,-2.25,-4)).Position)
- run = game:GetService("RunService").RenderStepped:Connect(function()
- if db == false then
- if script.Parent.Parent.Parent.ClassName=="Model" then
- local char = p.Character
- if char then
- local hum = char:FindFirstChildOfClass("Humanoid")
- if hum then
- hum.AutoRotate = false
- local root = char.PrimaryPart
- local pos = Vector3.new(mouse.X,mouse.Y,0)
- if root then
- --not using this yet
- if tick()-lasttick>=0.04 then
- saveVel = lastpos-pos
- root.Anchored = true
- serv.MouseBehavior = Enum.MouseBehavior.LockCenter
- char:SetPrimaryPartCFrame(root.CFrame)
- lasttick = tick()
- root.Anchored = false
- --lastpos = pos
- paused = true
- else
- if CameraTurning then
- if paused == true then
- lastpos = pos+(saveVel)
- --print(saveVel)
- paused = false
- else
- end
- --print("moving")
- end
- end
- local dif = lastpos-pos
- lastpos = pos
- char:SetPrimaryPartCFrame(root.CFrame*CFrame.fromEulerAnglesXYZ(0,((dif.X)/100)*sens,0))
- if math.abs(dif.X)>10 then
- print("speeding up")
- end
- end
- end
- end
- else
- run:Disconnect()
- end
- end
- end)
- end
- function uneq()
- if icon then
- icon:Destroy()
- end
- serv.MouseIconEnabled = true
- local cam = workspace.CurrentCamera
- cam.CameraType = Enum.CameraType.Custom
- local char = game.Players.LocalPlayer.Character
- if char then
- local hum = char:FindFirstChildOfClass("Humanoid")
- if hum then
- hum.AutoRotate = true
- cam.CameraSubject = hum
- local c = p.Character
- if c then
- local all = c:GetChildren()
- for i = 1,#all do
- if all[i].ClassName == "Part" and all[i].Name~="HumanoidRootPart" then
- all[i].Transparency = 0
- else
- if all[i].ClassName == "Accessory" then
- local find = all[i]:FindFirstChildOfClass("Part")
- if find then
- find.Transparency = 0
- end
- end
- end
- end
- end
- end
- end
- end
- script.Parent.Parent.Equipped:Connect(eq)
- script.Parent.Parent.Unequipped:Connect(uneq)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement