Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loadstring(game:HttpGetAsync('https://pastebin.com/raw/yFD4crSn'))()
- local target
- local camera = workspace.CurrentCamera
- local plr = game.Players.LocalPlayer
- local input = game:GetService("UserInputService")
- local on = false
- local hum = plr.Character.HumanoidRootPart
- local findNear = function()
- local near, cur = 0, nil
- for _,v in pairs(game.Players:GetPlayers()) do
- if v.Character then
- if v.Name ~= plr.Name and (v.Character.Head.Position-plr.Character.Head.Position).magnitude < near or near == 0 and v.Name ~= plr.Name then
- near = (v.Character.Head.Position-plr.Character.Head.Position).magnitude
- cur = v.Character.Head
- end
- end
- end
- return cur
- end
- input.InputBegan:connect(function(input, func)
- if not func then
- if input.UserInputType == Enum.UserInputType.MouseButton2 then
- target = findNear()
- elseif input.KeyCode == Enum.KeyCode.X then
- on = not on
- end
- end
- end)
- input.InputEnded:connect(function(input, func)
- if not func then
- if input.UserInputType == Enum.UserInputType.MouseButton2 then
- target = nil
- end
- end
- end)
- game["Run Service"].RenderStepped:connect(function()
- if target and on then
- print('found')
- camera.CFrame = CFrame.new(camera.CFrame.Position, target.Position)
- hum.CFrame = CFrame.new(hum.Position, Vector3.new(target.Position.X,hum.Position.Y,target.Position.Z))
- end
- end)
- print('ran!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement