Advertisement
Sharkkkkkk

Untitled

Mar 20th, 2021
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. cam=workspace.Camera;local a=game:GetService("Players")local b=a.LocalPlayer;local c=game:GetService("UserInputService")local d=false;c.InputBegan:Connect(function(e)if e.UserInputType==Enum.UserInputType.MouseButton2 then d=true end end)c.InputEnded:Connect(function(e)if e.UserInputType==Enum.UserInputType.MouseButton2 then d=false end end)local function f()local g=b.Character;local h=g and g:FindFirstChild("HumanoidRootPart")if not(g or h)then return end;local i=math.huge;local j;for k,l in ipairs(a:GetPlayers())do if l~=b and l.Team~=b.Team and l.Character and l.Character:FindFirstChild("HumanoidRootPart")then local m=l.Character.HumanoidRootPart;local n,o=cam:WorldToScreenPoint(l.Character.HumanoidRootPart.Position)local Ray=Ray.new(cam.CFrame.p,(l.Character.HumanoidRootPart.Position-cam.CFrame.p).unit*2048)local p=workspace:FindPartOnRayWithIgnoreList(Ray,{game.Players.LocalPlayer.Character})local q=(h.Position-m.Position).magnitude;if q<i and p~=nil and o then if p:IsDescendantOf(l.Character)then i=q;j=l end end end end;return j end;game.RunService.Stepped:Connect(function()if d==true and f()~=nil then cam.CFrame=CFrame.new(b.Character.Head.CFrame.p,f().Character.HumanoidRootPart.CFrame.p)end end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement