Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- SETTINGS
- local initialvelocity = 150
- local timecap = 4
- -- SCRIPT
- function Use(...)
- local isthisdone = true
- local timecounter = 0
- local shouldistrafe = 0
- local args = {...}
- local nearestdistance = math.huge
- local nearestplayer
- for _, i in pairs(game.Players:GetPlayers()) do
- local distancecheck = i:DistanceFromCharacter(args[1].Torso.Position)
- if distancecheck < nearestdistance then
- nearestplayer = i
- nearestdistance = distancecheck
- end
- end
- coroutine.wrap(function()
- while isthisdone == true do
- for i=0, 1, 0.1 do
- args[1].HumanoidRootPart.CFrame = args[1].HumanoidRootPart.CFrame:lerp(CFrame.lookAt(args[1].HumanoidRootPart.Position, nearestplayer.Character.Torso.Position), i)
- --args[1].HumanoidRootPart.CFrame *= CFrame.Angles(0,math.rad(1),0)
- wait()
- end
- end
- end)()
- local bv = args[1].Torso:FindFirstChildOfClass("BodyVelocity") or Instance.new("BodyVelocity", args[1].Torso)
- bv.maxForce = Vector3.new(math.huge, math.huge, math.huge)
- while timecap > timecounter do
- bv.velocity = (args[1].Torso.CFrame * CFrame.Angles(0,math.rad(90*math.ceil(shouldistrafe)),0)).LookVector * initialvelocity * (1 - (timecounter / timecap))
- if timecounter > timecap/4 and (args[1].Torso.Position - nearestplayer.Character.Torso.Position).Magnitude < (initialvelocity * (1.25 - (timecounter / timecap))) and math.random(1,50) == 1 and shouldistrafe == 0 then
- timecounter -= timecap/4
- shouldistrafe = 0.9
- end
- timecounter += 0.1
- if shouldistrafe > 0 then
- shouldistrafe -= 0.1
- end
- if shouldistrafe == 0 then
- timecounter -= timecap/8
- end
- wait(0.1)
- end
- local explosion = Instance.new("Explosion", args[1].Torso)
- explosion.DestroyJointRadiusPercent = 0
- explosion.BlastPressure = 0
- explosion.Position = args[1].Torso.Position
- bv.velocity *= 0
- isthisdone = false
- end
- return Use
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement