Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local a = game.Players
- local b = a.LocalPlayer
- local c = 800-- bullet velocity between 799-800
- local function d()
- local e = b.Character
- local f = e and e:FindFirstChild("HumanoidRootPart") and e.HumanoidRootPart.Position
- if f then
- local g, h = nil, math.huge
- for _, i in ipairs(a:GetPlayers()) do
- if i ~= b and i.Team ~= b.Team and i.Character and i.Character:FindFirstChild("HumanoidRootPart") then
- if i.Character.HumanoidRootPart.Position.Y > -10 then
- local j = (i.Character.HumanoidRootPart.Position - f).Magnitude
- if j < h then
- local k = i.Character:FindFirstChildOfClass("Humanoid")
- if k and k.Health > 0 then
- h = j
- g = i
- end
- end
- end
- end
- end
- return g, h
- end
- end
- local function l(m, n)
- if not m then return m end
- local o = m.Velocity
- return m.Position + (o * n)
- end
- local p = Drawing.new("Line")
- p.Visible = false
- p.Color = Color3.new(1, 0, 0)
- p.Thickness = 1
- game:GetService("RunService").Heartbeat:Connect(function()
- local s, ds = d()
- if s then
- local t = s.Character:FindFirstChild("HumanoidRootPart")
- if t then
- local u = b.Character.HumanoidRootPart.Position
- local v = l(t, (t.Position - u).Magnitude / c)
- p.From = Vector2.new(workspace.CurrentCamera:WorldToViewportPoint(u).X, workspace.CurrentCamera:WorldToViewportPoint(u).Y)
- p.To = Vector2.new(workspace.CurrentCamera:WorldToViewportPoint(v).X, workspace.CurrentCamera:WorldToViewportPoint(v).Y)
- p.Visible = true
- game:GetService("ReplicatedStorage").Event:FireServer("aim", {v})
- if ds <= 1500 then
- local args = {
- [1] = "shoot",
- [2] = {
- [1] = true
- }
- }
- game:GetService("ReplicatedStorage"):WaitForChild("Event"):FireServer(unpack(args))
- end
- end
- else
- p.Visible = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement