Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Part1 = Instance.new("Part")
- Motor6D2 = Instance.new("Motor6D")
- Part3 = Instance.new("Part")
- Motor6D4 = Instance.new("Motor6D")
- Motor6D5 = Instance.new("Motor6D")
- Motor6D6 = Instance.new("Motor6D")
- Motor6D7 = Instance.new("Motor6D")
- Motor6D8 = Instance.new("Motor6D")
- SpecialMesh9 = Instance.new("SpecialMesh")
- Part10 = Instance.new("Part")
- SpecialMesh11 = Instance.new("SpecialMesh")
- Part12 = Instance.new("Part")
- SpecialMesh13 = Instance.new("SpecialMesh")
- Part14 = Instance.new("Part")
- SpecialMesh15 = Instance.new("SpecialMesh")
- Part16 = Instance.new("Part")
- SpecialMesh17 = Instance.new("SpecialMesh")
- Weld18 = Instance.new("Weld")
- Part19 = Instance.new("Part")
- SpecialMesh20 = Instance.new("SpecialMesh")
- Decal21 = Instance.new("Decal")
- Humanoid22 = Instance.new("Humanoid")
- Color3Value23 = Instance.new("Color3Value")
- Script24 = Instance.new("Script")
- Tool25 = Instance.new("Tool")
- Part26 = Instance.new("Part")
- SpecialMesh27 = Instance.new("SpecialMesh")
- Sound28 = Instance.new("Sound")
- Sound29 = Instance.new("Sound")
- Script30 = Instance.new("Script")
- Animation31 = Instance.new("Animation")
- Script32 = Instance.new("Script")
- Script33 = Instance.new("Script")
- Sound34 = Instance.new("Sound")
- Sound35 = Instance.new("Sound")
- Script36 = Instance.new("Script")
- Model37 = Instance.new("Model")
- Script38 = Instance.new("Script")
- Backpack39 = Instance.new("Backpack")
- Script40 = Instance.new("Script")
- BindableEvent41 = Instance.new("BindableEvent")
- Script42 = Instance.new("Script")
- ObjectValue43 = Instance.new("ObjectValue")
- Script44 = Instance.new("Script")
- AnimationController45 = Instance.new("AnimationController")
- Script46 = Instance.new("Script")
- Model0.Name = "Bot"
- Model0.Parent = mas
- Part1.Name = "HumanoidRootPart"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(88.9357452, 2.99999905, -28.5324383, -0.325966269, 4.92454182e-22, -0.945381224, -1.82455399e-22, 0.999999523, 5.83815786e-22, 0.945381224, 3.62794076e-22, -0.325966269)
- Part1.Orientation = Vector3.new(0, -109.019997, 0)
- Part1.Position = Vector3.new(88.9357452, 2.99999905, -28.5324383)
- Part1.Rotation = Vector3.new(-180, -70.9799957, -180)
- Part1.Color = Color3.new(0.156863, 0.498039, 0.278431)
- Part1.Transparency = 1
- Part1.Size = Vector3.new(2, 2, 1)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Dark green")
- Part1.Material = Enum.Material.SmoothPlastic
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Dark green")
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.formFactor = Enum.FormFactor.Symmetric
- Motor6D2.Name = "Root Hip"
- Motor6D2.Parent = Part1
- Motor6D2.MaxVelocity = 0.10000000149012
- Motor6D2.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D2.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D2.Part0 = Part1
- Motor6D2.Part1 = Part3
- Motor6D2.part1 = Part3
- Part3.Name = "Torso"
- Part3.Parent = Model0
- Part3.CFrame = CFrame.new(88.9357452, 2.99999905, -28.5324383, -0.325966269, 4.92454182e-22, -0.945381224, -1.82455399e-22, 0.999999523, 5.83815786e-22, 0.945381224, 3.62794076e-22, -0.325966269)
- Part3.Orientation = Vector3.new(0, -109.019997, 0)
- Part3.Position = Vector3.new(88.9357452, 2.99999905, -28.5324383)
- Part3.Rotation = Vector3.new(-180, -70.9799957, -180)
- Part3.Color = Color3.new(0.898039, 0.894118, 0.87451)
- Part3.Size = Vector3.new(2, 2, 1)
- Part3.BottomSurface = Enum.SurfaceType.Smooth
- Part3.BrickColor = BrickColor.new("Light stone grey")
- Part3.Material = Enum.Material.DiamondPlate
- Part3.TopSurface = Enum.SurfaceType.Smooth
- Part3.brickColor = BrickColor.new("Light stone grey")
- Part3.FormFactor = Enum.FormFactor.Symmetric
- Part3.formFactor = Enum.FormFactor.Symmetric
- Motor6D4.Name = "Left Hip"
- Motor6D4.Parent = Part3
- Motor6D4.MaxVelocity = 0.10000000149012
- Motor6D4.C0 = CFrame.new(-0.5, -1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D4.C1 = CFrame.new(0, 1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D4.Part0 = Part3
- Motor6D4.Part1 = Part10
- Motor6D4.part1 = Part10
- Motor6D4.DesiredAngle = -0.038174632936716
- Motor6D5.Name = "Right Hip"
- Motor6D5.Parent = Part3
- Motor6D5.MaxVelocity = 0.10000000149012
- Motor6D5.C0 = CFrame.new(0.5, -1, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D5.C1 = CFrame.new(0, 1, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D5.Part0 = Part3
- Motor6D5.Part1 = Part12
- Motor6D5.part1 = Part12
- Motor6D5.DesiredAngle = -0.038174632936716
- Motor6D6.Name = "Left Shoulder"
- Motor6D6.Parent = Part3
- Motor6D6.MaxVelocity = 0.15000000596046
- Motor6D6.C0 = CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D6.C1 = CFrame.new(0.5, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D6.Part0 = Part3
- Motor6D6.Part1 = Part14
- Motor6D6.part1 = Part14
- Motor6D6.DesiredAngle = 0.038174632936716
- Motor6D7.Name = "Right Shoulder"
- Motor6D7.Parent = Part3
- Motor6D7.MaxVelocity = 0.75
- Motor6D7.C0 = CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D7.C1 = CFrame.new(-0.5, 0.5, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D7.Part0 = Part3
- Motor6D7.Part1 = Part16
- Motor6D7.part1 = Part16
- Motor6D7.DesiredAngle = 1.5700000524521
- Motor6D8.Name = "Neck"
- Motor6D8.Parent = Part3
- Motor6D8.MaxVelocity = 0.10000000149012
- Motor6D8.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D8.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D8.Part0 = Part3
- Motor6D8.Part1 = Part19
- Motor6D8.part1 = Part19
- SpecialMesh9.Parent = Part3
- SpecialMesh9.MeshId = "rbxasset://fonts/torso.mesh"
- SpecialMesh9.MeshType = Enum.MeshType.FileMesh
- Part10.Name = "Left Leg"
- Part10.Parent = Model0
- Part10.CFrame = CFrame.new(89.098732, 1.00000012, -29.0051289, -0.325966269, 4.92454132e-22, -0.945381224, -1.82455399e-22, 0.999999404, 5.83815786e-22, 0.945381224, 3.62794025e-22, -0.325966269)
- Part10.Orientation = Vector3.new(0, -109.019997, 0)
- Part10.Position = Vector3.new(89.098732, 1.00000012, -29.0051289)
- Part10.Rotation = Vector3.new(-180, -70.9799957, -180)
- Part10.Color = Color3.new(0.156863, 0.498039, 0.278431)
- Part10.Size = Vector3.new(1, 2, 1)
- Part10.BottomSurface = Enum.SurfaceType.Smooth
- Part10.BrickColor = BrickColor.new("Dark green")
- Part10.CanCollide = false
- Part10.Material = Enum.Material.DiamondPlate
- Part10.TopSurface = Enum.SurfaceType.Smooth
- Part10.brickColor = BrickColor.new("Dark green")
- Part10.FormFactor = Enum.FormFactor.Symmetric
- Part10.formFactor = Enum.FormFactor.Symmetric
- SpecialMesh11.Parent = Part10
- SpecialMesh11.MeshId = "rbxasset://fonts/leftleg.mesh"
- SpecialMesh11.MeshType = Enum.MeshType.FileMesh
- Part12.Name = "Right Leg"
- Part12.Parent = Model0
- Part12.CFrame = CFrame.new(88.7727585, 1.00000012, -28.0597477, -0.325966269, 4.92454132e-22, -0.945381224, -1.82455399e-22, 0.999999404, 5.83815786e-22, 0.945381224, 3.62794025e-22, -0.325966269)
- Part12.Orientation = Vector3.new(0, -109.019997, 0)
- Part12.Position = Vector3.new(88.7727585, 1.00000012, -28.0597477)
- Part12.Rotation = Vector3.new(-180, -70.9799957, -180)
- Part12.Color = Color3.new(0.156863, 0.498039, 0.278431)
- Part12.Size = Vector3.new(1, 2, 1)
- Part12.BottomSurface = Enum.SurfaceType.Smooth
- Part12.BrickColor = BrickColor.new("Dark green")
- Part12.CanCollide = false
- Part12.Material = Enum.Material.DiamondPlate
- Part12.TopSurface = Enum.SurfaceType.Smooth
- Part12.brickColor = BrickColor.new("Dark green")
- Part12.FormFactor = Enum.FormFactor.Symmetric
- Part12.formFactor = Enum.FormFactor.Symmetric
- SpecialMesh13.Parent = Part12
- SpecialMesh13.MeshId = "rbxasset://fonts/leftleg.mesh"
- SpecialMesh13.MeshType = Enum.MeshType.FileMesh
- Part14.Name = "Left Arm"
- Part14.Parent = Model0
- Part14.CFrame = CFrame.new(89.4246979, 2.99999905, -29.95051, -0.325966269, 4.92454132e-22, -0.945381224, -1.82455399e-22, 0.999999404, 5.83815786e-22, 0.945381224, 3.62794025e-22, -0.325966269)
- Part14.Orientation = Vector3.new(0, -109.019997, 0)
- Part14.Position = Vector3.new(89.4246979, 2.99999905, -29.95051)
- Part14.Rotation = Vector3.new(-180, -70.9799957, -180)
- Part14.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part14.Size = Vector3.new(1, 2, 1)
- Part14.BottomSurface = Enum.SurfaceType.Smooth
- Part14.BrickColor = BrickColor.new("Bright yellow")
- Part14.CanCollide = false
- Part14.Material = Enum.Material.DiamondPlate
- Part14.TopSurface = Enum.SurfaceType.Smooth
- Part14.brickColor = BrickColor.new("Bright yellow")
- Part14.FormFactor = Enum.FormFactor.Symmetric
- Part14.formFactor = Enum.FormFactor.Symmetric
- SpecialMesh15.Parent = Part14
- SpecialMesh15.MeshId = "rbxasset://fonts/leftleg.mesh"
- SpecialMesh15.MeshType = Enum.MeshType.FileMesh
- Part16.Name = "Right Arm"
- Part16.Parent = Model0
- Part16.CFrame = CFrame.new(88.4467926, 2.99999905, -27.1143665, -0.325966269, 4.92454132e-22, -0.945381224, -1.82455399e-22, 0.999999404, 5.83815786e-22, 0.945381224, 3.62794025e-22, -0.325966269)
- Part16.Orientation = Vector3.new(0, -109.019997, 0)
- Part16.Position = Vector3.new(88.4467926, 2.99999905, -27.1143665)
- Part16.Rotation = Vector3.new(-180, -70.9799957, -180)
- Part16.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part16.Size = Vector3.new(1, 2, 1)
- Part16.BottomSurface = Enum.SurfaceType.Smooth
- Part16.BrickColor = BrickColor.new("Bright yellow")
- Part16.CanCollide = false
- Part16.Material = Enum.Material.DiamondPlate
- Part16.TopSurface = Enum.SurfaceType.Smooth
- Part16.brickColor = BrickColor.new("Bright yellow")
- Part16.FormFactor = Enum.FormFactor.Symmetric
- Part16.formFactor = Enum.FormFactor.Symmetric
- SpecialMesh17.Parent = Part16
- SpecialMesh17.MeshId = "rbxasset://fonts/leftleg.mesh"
- SpecialMesh17.MeshType = Enum.MeshType.FileMesh
- Weld18.Name = "RightGrip"
- Weld18.Parent = Part16
- Weld18.C0 = CFrame.new(0, -1, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0)
- Weld18.C1 = CFrame.new(0.0500000007, -0.600000024, -1, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld18.Part0 = Part16
- Weld18.Part1 = Part26
- Weld18.part1 = Part26
- Part19.Name = "Head"
- Part19.Parent = Model0
- Part19.CFrame = CFrame.new(88.9357452, 4.49999809, -28.5324383, -0.325966269, 4.92454182e-22, -0.945381224, -1.82455399e-22, 0.999999523, 5.83815786e-22, 0.945381224, 3.62794076e-22, -0.325966269)
- Part19.Orientation = Vector3.new(0, -109.019997, 0)
- Part19.Position = Vector3.new(88.9357452, 4.49999809, -28.5324383)
- Part19.Rotation = Vector3.new(-180, -70.9799957, -180)
- Part19.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part19.Size = Vector3.new(2, 1, 1)
- Part19.BottomSurface = Enum.SurfaceType.Smooth
- Part19.BrickColor = BrickColor.new("Bright yellow")
- Part19.Material = Enum.Material.DiamondPlate
- Part19.TopSurface = Enum.SurfaceType.Smooth
- Part19.brickColor = BrickColor.new("Bright yellow")
- Part19.FormFactor = Enum.FormFactor.Symmetric
- Part19.formFactor = Enum.FormFactor.Symmetric
- SpecialMesh20.Parent = Part19
- SpecialMesh20.Scale = Vector3.new(1.25, 1.25, 1.25)
- Decal21.Name = "Face"
- Decal21.Parent = Part19
- Decal21.Texture = "rbxasset://textures/face.png"
- Humanoid22.Parent = Model0
- Humanoid22.LeftLeg = Part10
- Humanoid22.NameOcclusion = Enum.NameOcclusion.NoOcclusion
- Humanoid22.RightLeg = Part12
- Humanoid22.Torso = Part1
- Color3Value23.Name = "Team"
- Color3Value23.Parent = Humanoid22
- Color3Value23.Value = Color3.new(0.156863, 0.498039, 0.278431)
- Script24.Name = "Sound"
- Script24.Parent = Model0
- table.insert(cors,sandbox(Script24,function()
- wait(0.5)
- function waitForChild(parent, childName)
- local child = parent:findFirstChild(childName)
- if child then return child end
- while true do
- child = parent.ChildAdded:wait()
- if child.Name==childName then return child end
- end
- end
- function newSound(id)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.archivable = false
- sound.Parent = script.Parent.Head
- return sound
- end
- local sDied = newSound("rbxasset://sounds/uuhhh.wav")
- local sFallingDown = newSound("rbxasset://sounds/splat.wav")
- local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
- local sGettingUp = newSound("rbxasset://sounds/hit.wav")
- local sJumping = newSound("rbxasset://sounds/button.wav")
- local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
- sRunning.Looped = true
- local Figure = script.Parent
- local Head = waitForChild(Figure, "Head")
- local Humanoid = waitForChild(Figure, "Humanoid")
- function onDied()
- sDied:Play()
- end
- function onState(state, sound)
- if state then
- sound:Play()
- else
- sound:Pause()
- end
- end
- function onRunning(speed)
- if speed>1 then
- sRunning:Play()
- else
- sRunning:Pause()
- end
- end
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
- Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
- Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
- Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
- end))
- Tool25.Name = "RocketLauncher"
- Tool25.Parent = Model0
- Tool25.TextureId = "http://www.roblox.com/asset/?id=94689922"
- Tool25.CanBeDropped = false
- Tool25.Grip = CFrame.new(0.0500000007, -0.600000024, -1, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Tool25.GripPos = Vector3.new(0.0500000007, -0.600000024, -1)
- Tool25.ToolTip = "Rocket Launcher"
- Part26.Name = "Handle"
- Part26.Parent = Tool25
- Part26.CFrame = CFrame.new(89.0303192, 2.99999905, -26.9660549, -0.325966269, 0.945381224, 4.92454132e-22, -1.82455399e-22, -5.83815786e-22, 0.999999404, 0.945381224, 0.325966269, 3.62794025e-22)
- Part26.Orientation = Vector3.new(-89.9399948, 53.6199989, -162.639999)
- Part26.Position = Vector3.new(89.0303192, 2.99999905, -26.9660549)
- Part26.Rotation = Vector3.new(-90, 0, -109.019997)
- Part26.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part26.Size = Vector3.new(0.839999974, 1.14999998, 3.55000019)
- Part26.BottomSurface = Enum.SurfaceType.Smooth
- Part26.BrickColor = BrickColor.new("Dark stone grey")
- Part26.CanCollide = false
- Part26.Locked = true
- Part26.TopSurface = Enum.SurfaceType.Smooth
- Part26.brickColor = BrickColor.new("Dark stone grey")
- Part26.FormFactor = Enum.FormFactor.Custom
- Part26.formFactor = Enum.FormFactor.Custom
- SpecialMesh27.Parent = Part26
- SpecialMesh27.MeshId = "http://www.roblox.com/asset/?id=94690054"
- SpecialMesh27.TextureId = "http://www.roblox.com/asset/?id=94689966"
- SpecialMesh27.MeshType = Enum.MeshType.FileMesh
- Sound28.Name = "ReloadSound"
- Sound28.Parent = Part26
- Sound28.SoundId = "http://www.roblox.com/Asset?ID=94132726"
- Sound28.Volume = 1
- Sound29.Name = "Equip"
- Sound29.Parent = Part26
- Sound29.Pitch = 1.3300000429153
- Sound29.PlaybackSpeed = 1.3300000429153
- Sound29.SoundId = "http://www.roblox.com/Asset?ID=97103817"
- Script30.Name = "Animation"
- Script30.Parent = Tool25
- table.insert(cors,sandbox(Script30,function()
- local Tool = script.Parent
- local Char = Tool.Parent
- local Animator = Char:findFirstChild("AnimationController") or Instance.new("AnimationController",Char)
- local FireAndReloadAnimation = script:WaitForChild('FireAndReload')
- local FireAndReloadTrack = Animator:LoadAnimation(FireAndReloadAnimation)
- local function OnChanged(property)
- if property == 'Enabled' and Tool.Enabled == false then
- -- Play fire and reload animation
- if FireAndReloadTrack then
- FireAndReloadTrack:Play()
- end
- end
- end
- Tool.Changed:connect(OnChanged)
- end))
- Animation31.Name = "FireAndReload"
- Animation31.Parent = Script30
- Animation31.AnimationId = "http://www.roblox.com/Asset?ID=94771598"
- Script32.Name = "VisualizeReload"
- Script32.Parent = Tool25
- table.insert(cors,sandbox(Script32,function()
- local ROCKET_MESH_ID = 'http://www.roblox.com/asset/?id=94690081'
- local ROCKET_MESH_SCALE = Vector3.new(1, 1, 1)
- local ROCKET_SHOW_TIME = 1 -- Seconds after animation begins to show the rocket
- local ROCKET_HIDE_TIME = 2.15 -- Seconds after animation begins to hide the rocket
- local Tool = script.Parent
- local ToolHandle = Tool.Handle
- local MyModel = Tool.Parent
- local ReloadRocket = Instance.new('Part')
- ReloadRocket.Name = "Ammo"
- ReloadRocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
- ReloadRocket.Size = Vector3.new() -- As small as possible
- local mesh = Instance.new('SpecialMesh', ReloadRocket)
- mesh.MeshId = ROCKET_MESH_ID
- mesh.Scale = ROCKET_MESH_SCALE
- mesh.TextureId = ToolHandle.Mesh.TextureId
- local function OnChanged(property)
- if property == 'Enabled' and Tool.Enabled == false then
- -- Show the next rocket going into the launcher
- StillEquipped = true
- wait(ROCKET_SHOW_TIME)
- local torso = MyModel:FindFirstChild('Torso')
- if torso and torso:FindFirstChild('Left Shoulder') then
- local leftArm = MyModel:FindFirstChild('Left Arm')
- if leftArm then
- local weld = ReloadRocket:FindFirstChild('Weld')
- if not weld then
- weld = Instance.new('Weld')
- weld.Part0 = leftArm
- weld.Part1 = ReloadRocket
- weld.C1 = CFrame.new(Vector3.new(0, 1, 0))
- weld.Parent = ReloadRocket
- end
- ReloadRocket.Parent = MyModel
- end
- wait(ROCKET_HIDE_TIME - ROCKET_SHOW_TIME)
- if ReloadRocket.Parent == MyModel then
- ReloadRocket.Parent = nil
- end
- end
- end
- end
- Tool.Changed:connect(OnChanged)
- end))
- Script33.Name = "Launcher"
- Script33.Parent = Tool25
- table.insert(cors,sandbox(Script33,function()
- -----------------
- --| Constants |--
- -----------------
- local COOLDOWN = 3.0 -- Seconds until tool can be used again
- -- RocketPropulsion Fields
- local TARGET_RADIUS = 5
- local MAX_SPEED = 60
- local MAX_TORQUE = Vector3.new(4e6, 4e6, 0)
- local MAX_THRUST = 50000
- local THRUST_P = 500
- local THRUST_D = 50000
- local TARGET_OVERSHOOT_DISTANCE = 10000000
- -- How far away from the handle does the user have to click for
- -- the rocket to allow killing of the user themself.
- local CLOSE_SHOT_DISTANCE = 10
- -- Rocket Fields
- local ROCKET_MESH_ID = 'http://www.roblox.com/asset/?id=94690081'
- local ROCKET_MESH_SCALE = Vector3.new(2.5, 2.5, 2)
- local ROCKET_PART_SIZE = Vector3.new(1, 1, 4)
- --------------------
- --| WaitForChild |--
- --------------------
- -- Waits for parent.child to exist, then returns it
- local function WaitForChild(parent, childName)
- assert(parent, "ERROR: WaitForChild: parent is nil")
- while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
- return parent[childName]
- end
- -----------------
- --| Variables |--
- -----------------
- local DebrisService = Game:GetService('Debris')
- local PlayersService = Game:GetService('Players')
- local Tool = script.Parent
- local ToolHandle = Tool.Handle
- local RocketScript = WaitForChild(script, 'Rocket')
- local SwooshSound = WaitForChild(script, 'Swoosh')
- local BoomSound = WaitForChild(script, 'Boom')
- local ReloadSound = WaitForChild(ToolHandle, 'ReloadSound')
- local EquipSound = WaitForChild(ToolHandle, 'Equip')
- local MyModel = nil
- local BaseRocket = nil
- local RocketClone = nil
- -----------------
- --| Functions |--
- -----------------
- local function MakeBaseRocket()
- -- Set up the rocket part
- local rocket = Instance.new('Part')
- rocket.Name = 'Rocket'
- rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
- rocket.Size = ROCKET_PART_SIZE
- rocket.CanCollide = false
- rocket.BottomSurface = Enum.SurfaceType.Smooth
- rocket.TopSurface = Enum.SurfaceType.Smooth
- -- Add the mesh
- local mesh = Instance.new('SpecialMesh', rocket)
- mesh.MeshId = ROCKET_MESH_ID
- mesh.Scale = ROCKET_MESH_SCALE
- mesh.TextureId = ToolHandle.Mesh.TextureId
- -- Add fire
- local fire = Instance.new('Fire', rocket)
- fire.Heat = 5
- fire.Size = 2
- -- Add the propulsion
- local rocketPropulsion = Instance.new('RocketPropulsion', rocket)
- rocketPropulsion.CartoonFactor = 1
- rocketPropulsion.TargetRadius = TARGET_RADIUS
- rocketPropulsion.MaxSpeed = MAX_SPEED
- rocketPropulsion.MaxTorque = MAX_TORQUE
- rocketPropulsion.MaxThrust = MAX_THRUST
- rocketPropulsion.ThrustP = THRUST_P
- rocketPropulsion.ThrustD = THRUST_D
- -- Clone the sounds
- local swooshSoundClone = SwooshSound:Clone()
- swooshSoundClone.Parent = rocket
- local boomSoundClone = BoomSound:Clone()
- boomSoundClone.PlayOnRemove = true
- boomSoundClone.Parent = rocket
- -- Attach creator tags
- local creatorTag = Instance.new('ObjectValue', rocket)
- creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
- creatorTag.Value = MyModel
- local nameTag = Instance.new('StringValue', creatorTag)
- nameTag.Name = 'weaponName'
- nameTag.Value = Tool.Name
- local iconTag = Instance.new('StringValue', creatorTag)
- iconTag.Name = 'weaponIcon'
- iconTag.Value = Tool.TextureId
- -- The "close shot" tag. True if the rocket should be able to kill the
- -- creator.
- local closeShot = Instance.new('BoolValue', rocket)
- closeShot.Name = 'closeShot'
- closeShot.Value = false
- -- Finally, clone the rocket script and enable it
- local rocketScriptClone = RocketScript:Clone()
- rocketScriptClone.Parent = rocket
- rocketScriptClone.Disabled = false
- return rocket
- end
- MyModel = Tool.Parent
- BaseRocket = MakeBaseRocket()
- RocketClone = BaseRocket:Clone()
- local function OnActivated(targetPosition)
- if Tool.Enabled and MyModel and MyModel:FindFirstChild('Humanoid') and MyModel.Humanoid.Health > 0 then
- Tool.Enabled = false
- -- Maybe set the "closeShot" flag
- if (targetPosition - ToolHandle.Position).magnitude < CLOSE_SHOT_DISTANCE then
- RocketClone.closeShot.Value = true
- end
- -- Position the rocket clone
- local spawnPosition = ToolHandle.Position + (ToolHandle.CFrame.lookVector * (ToolHandle.Size.Z / 2))
- RocketClone.CFrame = CFrame.new(spawnPosition, targetPosition) --NOTE: This must be done before assigning Parent
- DebrisService:AddItem(RocketClone, 30)
- RocketClone.Parent = Workspace
- -- Assign target and launch!
- local rocketPropulsion = RocketClone:FindFirstChild('RocketPropulsion')
- if rocketPropulsion then
- local direction = (targetPosition - RocketClone.Position).unit
- rocketPropulsion.TargetOffset = RocketClone.Position + (direction * TARGET_OVERSHOOT_DISTANCE)
- rocketPropulsion:Fire()
- end
- -- Prepare the next rocket to be fired
- RocketClone = BaseRocket:Clone()
- ReloadSound:Play()
- -- Cooldown
- wait(COOLDOWN)
- -- Stop the reloading sound if it hasn't already finished
- Tool.Enabled = true
- end
- end
- local AI = MyModel:WaitForChild("AI")
- local down = AI:WaitForChild("MouseDown")
- down.Event:connect(OnActivated)
- end))
- Sound34.Name = "Boom"
- Sound34.Parent = Script33
- Sound34.SoundId = "rbxasset://sounds/collide.wav"
- Sound34.Volume = 1
- Sound35.Name = "Swoosh"
- Sound35.Parent = Script33
- Sound35.Looped = true
- Sound35.SoundId = "rbxasset://sounds/Rocket whoosh 01.wav"
- Sound35.Volume = 0.69999998807907
- Script36.Name = "Rocket"
- Script36.Parent = Script33
- table.insert(cors,sandbox(Script36,function()
- -----------------
- --| Constants |--
- -----------------
- local BLAST_RADIUS = 6
- --local BLAST_PRESSURE = 750000
- local BLAST_PRESSURE = 0
- local IGNORE_LIST = {rocket = 1, handle = 1, effect = 1, water = 1} -- Rocket will fly through things named these
- --NOTE: Keys must be lowercase, values must evaluate to true
- --------------------
- --| WaitForChild |--
- --------------------
- -- Waits for parent.child to exist, then returns it
- local function WaitForChild(parent, childName)
- assert(parent, "ERROR: WaitForChild: parent is nil")
- while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
- return parent[childName]
- end
- -----------------
- --| Variables |--
- -----------------
- local DebrisService = Game:GetService('Debris')
- local Rocket = script.Parent
- local CreatorTag = WaitForChild(Rocket, 'creator')
- local SwooshSound = WaitForChild(Rocket, 'Swoosh')
- -----------------
- --| Functions |--
- -----------------
- -- Returns the ancestor that contains a Humanoid, if it exists
- local function FindCharacterAncestor(subject)
- if subject and subject ~= Workspace then
- local humanoid = subject:FindFirstChild('Humanoid')
- if humanoid then
- return subject, humanoid
- else
- return FindCharacterAncestor(subject.Parent)
- end
- end
- return nil
- end
- local function OnExplosionHit(hitPart)
- if hitPart then
- local _, humanoid = FindCharacterAncestor(hitPart.Parent)
- if humanoid and humanoid.Health > 0 then
- CreatorTag:Clone().Parent=humanoid
- humanoid:TakeDamage(100)
- end
- end
- end
- local function OnTouched(otherPart)
- if Rocket and otherPart then
- -- Fly through anything in the ignore list
- if IGNORE_LIST[string.lower(otherPart.Name)] then
- return
- end
- -- Fly through the creator
- local myPlayer = CreatorTag.Value
- if myPlayer and myPlayer:IsAncestorOf(otherPart) then
- return
- end
- OnExplosionHit(hitPart)
- -- Boom
- local explosion = Instance.new('Explosion')
- explosion.BlastPressure = BLAST_PRESSURE
- explosion.BlastRadius = BLAST_RADIUS
- explosion.Position = Rocket.Position
- explosion.Hit:connect(OnExplosionHit)
- explosion.Parent = Workspace
- -- Move this script and the creator tag (so our custom logic can execute), then destroy the rocket
- script.Parent = explosion
- CreatorTag.Parent = script
- Rocket:Destroy()
- end
- end
- --------------------
- --| Script Logic |--
- --------------------
- SwooshSound:Play()
- Rocket.Touched:connect(OnTouched)
- -- Manually call OnTouched for parts the rocket might have spawned inside of
- --TODO: Remove when Touched correctly fires for parts spawned within other parts
- local partClone = Rocket:Clone()
- partClone:ClearAllChildren()
- partClone.Transparency = 1
- --partClone.Anchored = true --NOTE: DOES NOT WORK if part is anchored!
- DebrisService:AddItem(partClone, 0.1)
- partClone.Parent = Workspace
- partClone.Touched:connect(OnTouched)
- end))
- Script36.Disabled = true
- Model37.Name = "DebugPathDraw"
- Model37.Parent = Model0
- Script38.Name = "Animate"
- Script38.Parent = Model0
- table.insert(cors,sandbox(Script38,function()
- function waitForChild(parent, childName)
- local child = parent:findFirstChild(childName)
- if child then return child end
- while true do
- child = parent.ChildAdded:wait()
- if child.Name==childName then return child end
- end
- end
- -- ANIMATION
- -- declarations
- local Figure = script.Parent
- local Torso = waitForChild(Figure, "Torso")
- local RightShoulder = waitForChild(Torso, "Right Shoulder")
- local LeftShoulder = waitForChild(Torso, "Left Shoulder")
- local RightHip = waitForChild(Torso, "Right Hip")
- local LeftHip = waitForChild(Torso, "Left Hip")
- local Neck = waitForChild(Torso, "Neck")
- local Humanoid = waitForChild(Figure, "Humanoid")
- local pose = "Standing"
- local toolAnim = "None"
- local toolAnimTime = 0
- local jumpMaxLimbVelocity = 0.75
- -- functions
- function onRunning(speed)
- if speed>1 then
- pose = "Running"
- else
- pose = "Standing"
- end
- end
- function onDied()
- pose = "Dead"
- end
- function onJumping()
- pose = "Jumping"
- end
- function onClimbing()
- pose = "Climbing"
- end
- function onGettingUp()
- pose = "GettingUp"
- end
- function onFreeFall()
- pose = "FreeFall"
- end
- function onFallingDown()
- pose = "FallingDown"
- end
- function onSeated()
- pose = "Seated"
- end
- function onPlatformStanding()
- pose = "PlatformStanding"
- end
- function onSwimming(speed)
- if speed>0 then
- pose = "Running"
- else
- pose = "Standing"
- end
- end
- function moveJump()
- RightShoulder.MaxVelocity = jumpMaxLimbVelocity
- LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
- RightShoulder:SetDesiredAngle(3.14)
- LeftShoulder:SetDesiredAngle(-3.14)
- RightHip:SetDesiredAngle(0)
- LeftHip:SetDesiredAngle(0)
- end
- -- same as jump for now
- function moveFreeFall()
- RightShoulder.MaxVelocity = jumpMaxLimbVelocity
- LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
- RightShoulder:SetDesiredAngle(3.14)
- LeftShoulder:SetDesiredAngle(-3.14)
- RightHip:SetDesiredAngle(0)
- LeftHip:SetDesiredAngle(0)
- end
- function moveSit()
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- RightShoulder:SetDesiredAngle(3.14 /2)
- LeftShoulder:SetDesiredAngle(-3.14 /2)
- RightHip:SetDesiredAngle(3.14 /2)
- LeftHip:SetDesiredAngle(-3.14 /2)
- end
- function getTool()
- for _, kid in ipairs(Figure:GetChildren()) do
- if kid.className == "Tool" then return kid end
- end
- return nil
- end
- function getToolAnim(tool)
- for _, c in ipairs(tool:GetChildren()) do
- if c.Name == "toolanim" and c.className == "StringValue" then
- return c
- end
- end
- return nil
- end
- function animateTool()
- if (toolAnim == "None") then
- RightShoulder:SetDesiredAngle(1.57)
- return
- end
- if (toolAnim == "Slash") then
- RightShoulder.MaxVelocity = 0.5
- RightShoulder:SetDesiredAngle(0)
- return
- end
- if (toolAnim == "Lunge") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightHip.MaxVelocity = 0.5
- LeftHip.MaxVelocity = 0.5
- RightShoulder:SetDesiredAngle(1.57)
- LeftShoulder:SetDesiredAngle(1.0)
- RightHip:SetDesiredAngle(1.57)
- LeftHip:SetDesiredAngle(1.0)
- return
- end
- end
- function move(time)
- local amplitude
- local frequency
- if (pose == "Jumping") then
- moveJump()
- return
- end
- if (pose == "FreeFall") then
- moveFreeFall()
- return
- end
- if (pose == "Seated") then
- moveSit()
- return
- end
- local climbFudge = 0
- if (pose == "Running") then
- if (RightShoulder.CurrentAngle > 1.5 or RightShoulder.CurrentAngle < -1.5) then
- RightShoulder.MaxVelocity = jumpMaxLimbVelocity
- else
- RightShoulder.MaxVelocity = 0.15
- end
- if (LeftShoulder.CurrentAngle > 1.5 or LeftShoulder.CurrentAngle < -1.5) then
- LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
- else
- LeftShoulder.MaxVelocity = 0.15
- end
- amplitude = 1
- frequency = 9
- elseif (pose == "Climbing") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- amplitude = 1
- frequency = 9
- climbFudge = 3.14
- else
- amplitude = 0.1
- frequency = 1
- end
- desiredAngle = amplitude * math.sin(time*frequency)
- RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
- LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
- RightHip:SetDesiredAngle(-desiredAngle)
- LeftHip:SetDesiredAngle(-desiredAngle)
- local tool = getTool()
- if tool then
- animStringValueObject = getToolAnim(tool)
- if animStringValueObject then
- toolAnim = animStringValueObject.Value
- -- message recieved, delete StringValue
- animStringValueObject.Parent = nil
- toolAnimTime = time + .3
- end
- if time > toolAnimTime then
- toolAnimTime = 0
- toolAnim = "None"
- end
- animateTool()
- else
- toolAnim = "None"
- toolAnimTime = 0
- end
- end
- -- connect events
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(onJumping)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.GettingUp:connect(onGettingUp)
- Humanoid.FreeFalling:connect(onFreeFall)
- Humanoid.FallingDown:connect(onFallingDown)
- Humanoid.Seated:connect(onSeated)
- Humanoid.PlatformStanding:connect(onPlatformStanding)
- Humanoid.Swimming:connect(onSwimming)
- -- main program
- local runService = game:service("RunService");
- while Figure.Parent~=nil do
- local _, time = wait(0.1)
- move(time)
- end
- end))
- Backpack39.Name = "AI"
- Backpack39.Parent = Model0
- Script40.Name = "Pathfinding"
- Script40.Parent = Backpack39
- table.insert(cors,sandbox(Script40,function()
- debugMode = false
- targetNPCs = false
- --
- h = script.Parent.Parent:WaitForChild("Humanoid")
- pathService = game:GetService("PathfindingService")
- targetV = script.Parent:WaitForChild("Target")
- function closestTargetAndPath()
- local humanoids = {}
- if targetNPCs then
- local function recurse(o)
- for _,obj in pairs(o:GetChildren()) do
- if obj:IsA("Model") then
- if obj:findFirstChild("Humanoid") and obj:findFirstChild("Torso") and obj.Humanoid ~= h and obj.Humanoid.Health > 0 and not obj:findFirstChild("ForceField") then
- table.insert(humanoids,obj.Humanoid)
- end
- end
- recurse(obj)
- end
- end
- recurse(workspace)
- else
- for _,v in pairs(game.Players:GetPlayers()) do
- if v.Character and v.Character:findFirstChild("HumanoidRootPart") and v.Character:findFirstChild("Humanoid") and v.Character.Humanoid.Health > 0 and not v:findFirstChild("ForceField") then
- table.insert(humanoids,v.Character.Humanoid)
- end
- end
- end
- local closest,path,dist
- for _,humanoid in pairs(humanoids) do
- local myPath = pathService:ComputeRawPathAsync(h.Torso.Position,humanoid.Torso.Position,500)
- if myPath.Status ~= Enum.PathStatus.FailFinishNotEmpty then
- -- Now that we have a successful path, we need to figure out how far we need to actually travel to reach this point.
- local myDist = 0
- local previous = h.Torso.Position
- for _,point in pairs(myPath:GetPointCoordinates()) do
- myDist = myDist + (point-previous).magnitude
- previous = point
- end
- if not dist or myDist < dist then -- if true, this is the closest path so far.
- closest = humanoid
- path = myPath
- dist = myDist
- end
- end
- end
- return closest,path
- end
- function goToPos(loc)
- h:MoveTo(loc)
- local distance = (loc-h.Torso.Position).magnitude
- local start = tick()
- while distance > 4 do
- if tick()-start > distance/h.WalkSpeed then -- Something may have gone wrong. Just break.
- break
- end
- distance = (loc-h.Torso.Position).magnitude
- wait()
- end
- end
- while wait() do
- local target,path = closestTargetAndPath()
- local didBreak = false
- local targetStart
- if target and h.Torso then
- targetV.Value = target
- targetStart = target.Torso.Position
- roaming = false
- local previous = h.Torso.Position
- local points = path:GetPointCoordinates()
- local s = #points > 1 and 2 or 1
- for i = s,#points do
- local point = points[i]
- if didBreak then
- break
- end
- if target and target.Torso and target.Health > 0 then
- if (target.Torso.Position-targetStart).magnitude < 1.5 then
- local pos = previous:lerp(point,.5)
- local moveDir = ((pos - h.Torso.Position).unit * 2)
- goToPos(previous:lerp(point,.5))
- previous = point
- end
- else
- didBreak = true
- break
- end
- end
- else
- targetV.Value = nil
- end
- if not didBreak and targetStart then
- goToPos(targetStart)
- end
- end
- end))
- BindableEvent41.Name = "MouseDown"
- BindableEvent41.Parent = Backpack39
- Script42.Name = "AutoJump"
- Script42.Parent = Backpack39
- table.insert(cors,sandbox(Script42,function()
- local h = script.Parent.Parent:WaitForChild("Humanoid")
- while wait(math.random()/4) do
- local check1 = game.Workspace:FindPartOnRay(Ray.new(h.Torso.Position-Vector3.new(0,1.5,0), h.Torso.CFrame.lookVector*3), h.Parent)
- local check2 = game.Workspace:FindPartOnRay(Ray.new(h.Torso.Position+Vector3.new(0,1.5,0), h.Torso.CFrame.lookVector*3), h.Parent)
- if check1 or check2 then
- h.Jump = true
- end
- end
- end))
- ObjectValue43.Name = "Target"
- ObjectValue43.Parent = Backpack39
- Script44.Name = "WeaponFiring"
- Script44.Parent = Backpack39
- table.insert(cors,sandbox(Script44,function()
- local target = script.Parent:WaitForChild("Target")
- local torso = script.Parent.Parent:WaitForChild("Torso")
- local down = script.Parent:WaitForChild("MouseDown")
- function handler(new)
- if target.Value then
- while target.Value == new do
- if target.Value and target.Value.Parent == nil then
- target.Value = nil
- return
- end
- local look = (new.Torso.Position-torso.Position).unit * 300
- local hit = workspace:FindPartOnRayWithIgnoreList(Ray.new(torso.Position,look),{script.Parent.Parent,new.Parent})
- if not hit or (new.Torso.Position-torso.Position).magnitude < 10 then
- down:Fire(new.Torso.Position)
- end
- wait(0.2)
- end
- end
- end
- target.Changed:connect(handler)
- if target.Value then
- handler(target.Value)
- end
- end))
- AnimationController45.Parent = Model0
- Script46.Name = "Respawn"
- Script46.Parent = Model0
- table.insert(cors,sandbox(Script46,function()
- local humanoid = script.Parent:WaitForChild("Humanoid")
- local backup = script.Parent:clone()
- humanoid.Died:connect(function ()
- wait(5)
- backup.Parent = workspace
- if script.Parent then
- script.Parent:Destroy()
- end
- end)
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement