Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- 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")
- SpecialMesh4 = Instance.new("SpecialMesh")
- Motor6D5 = Instance.new("Motor6D")
- Motor6D6 = Instance.new("Motor6D")
- Motor6D7 = Instance.new("Motor6D")
- Motor6D8 = Instance.new("Motor6D")
- Motor6D9 = Instance.new("Motor6D")
- 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")
- Part18 = Instance.new("Part")
- SpecialMesh19 = Instance.new("SpecialMesh")
- Decal20 = Instance.new("Decal")
- Sound21 = Instance.new("Sound")
- Sound22 = Instance.new("Sound")
- Sound23 = Instance.new("Sound")
- Sound24 = Instance.new("Sound")
- Sound25 = Instance.new("Sound")
- Sound26 = Instance.new("Sound")
- Humanoid27 = Instance.new("Humanoid")
- Color3Value28 = Instance.new("Color3Value")
- Script29 = Instance.new("Script")
- Model30 = Instance.new("Model")
- Script31 = Instance.new("Script")
- Backpack32 = Instance.new("Backpack")
- Script33 = Instance.new("Script")
- BindableEvent34 = Instance.new("BindableEvent")
- Script35 = Instance.new("Script")
- ObjectValue36 = Instance.new("ObjectValue")
- AnimationController37 = Instance.new("AnimationController")
- Script38 = Instance.new("Script")
- Model0.Name = "Pathfinding Wanderer"
- Model0.Parent = mas
- Part1.Name = "HumanoidRootPart"
- Part1.Parent = Model0
- Part1.Material = Enum.Material.SmoothPlastic
- Part1.BrickColor = BrickColor.new("Dark green")
- Part1.Transparency = 1
- Part1.Rotation = Vector3.new(0, -18.2399998, 0)
- Part1.RotVelocity = Vector3.new(-0.0160937011, -8.44836613e-05, 0.0028687357)
- Part1.Velocity = Vector3.new(-0.00699306419, 6.5494175, -0.0277098417)
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.Size = Vector3.new(0.887999892, 0.887999892, 0.443999946)
- Part1.CFrame = CFrame.new(-14.8580265, 6.19717216, 26.9827309, 0.949730039, 7.18516989e-13, -0.313070148, 3.12449421e-13, 1, 3.24291397e-12, 0.313070148, -3.17771113e-12, 0.949730039)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.Color = Color3.new(0.156863, 0.498039, 0.278431)
- Part1.Position = Vector3.new(-14.8580265, 6.19717216, 26.9827309)
- Part1.Orientation = Vector3.new(0, -18.2399998, 0)
- Part1.Color = Color3.new(0.156863, 0.498039, 0.278431)
- Motor6D2.Name = "Root Hip"
- Motor6D2.Parent = Part1
- 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.MaxVelocity = 0.10000000149012
- Part3.Name = "Torso"
- Part3.Parent = Model0
- Part3.Material = Enum.Material.DiamondPlate
- Part3.BrickColor = BrickColor.new("Light stone grey")
- Part3.Rotation = Vector3.new(0, -18.2399998, 0)
- Part3.RotVelocity = Vector3.new(-0.0160937011, -8.44836613e-05, 0.0028687357)
- Part3.Velocity = Vector3.new(-0.00699306419, 6.5494175, -0.0277098417)
- Part3.FormFactor = Enum.FormFactor.Symmetric
- Part3.Size = Vector3.new(0.887999892, 0.887999892, 0.443999946)
- Part3.CFrame = CFrame.new(-14.8580265, 6.19717216, 26.9827309, 0.949730039, 7.18516989e-13, -0.313070148, 3.12449421e-13, 1, 3.24291397e-12, 0.313070148, -3.17771113e-12, 0.949730039)
- Part3.BottomSurface = Enum.SurfaceType.Smooth
- Part3.TopSurface = Enum.SurfaceType.Smooth
- Part3.Color = Color3.new(0.898039, 0.894118, 0.87451)
- Part3.Position = Vector3.new(-14.8580265, 6.19717216, 26.9827309)
- Part3.Orientation = Vector3.new(0, -18.2399998, 0)
- Part3.Color = Color3.new(0.898039, 0.894118, 0.87451)
- SpecialMesh4.Parent = Part3
- SpecialMesh4.MeshId = "rbxasset://fonts/torso.mesh"
- SpecialMesh4.Scale = Vector3.new(0.443999976, 0.443999976, 0.443999976)
- SpecialMesh4.MeshType = Enum.MeshType.FileMesh
- SpecialMesh4.Scale = Vector3.new(0.443999976, 0.443999976, 0.443999976)
- Motor6D5.Name = "Left Hip"
- Motor6D5.Parent = Part3
- Motor6D5.C0 = CFrame.new(-0.221999973, -0.443999946, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D5.C1 = CFrame.new(0, 0.443999946, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D5.Part0 = Part3
- Motor6D5.Part1 = Part10
- Motor6D5.MaxVelocity = 0.10000000149012
- Motor6D6.Name = "Right Hip"
- Motor6D6.Parent = Part3
- Motor6D6.C0 = CFrame.new(0.221999973, -0.443999946, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D6.C1 = CFrame.new(0, 0.443999946, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D6.Part0 = Part3
- Motor6D6.Part1 = Part12
- Motor6D6.MaxVelocity = 0.10000000149012
- Motor6D7.Name = "Left Shoulder"
- Motor6D7.Parent = Part3
- Motor6D7.C0 = CFrame.new(-0.443999946, 0.221999973, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D7.C1 = CFrame.new(0.221999973, 0.221999973, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D7.Part0 = Part3
- Motor6D7.Part1 = Part14
- Motor6D7.CurrentAngle = -3.1400001049042
- Motor6D7.DesiredAngle = -3.1400001049042
- Motor6D7.MaxVelocity = 0.75
- Motor6D8.Name = "Right Shoulder"
- Motor6D8.Parent = Part3
- Motor6D8.C0 = CFrame.new(0.443999946, 0.221999973, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D8.C1 = CFrame.new(-0.221999973, 0.221999973, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D8.Part0 = Part3
- Motor6D8.Part1 = Part16
- Motor6D8.CurrentAngle = 3.1400001049042
- Motor6D8.DesiredAngle = 3.1400001049042
- Motor6D8.MaxVelocity = 0.75
- Motor6D9.Name = "Neck"
- Motor6D9.Parent = Part3
- Motor6D9.C0 = CFrame.new(0, 0.443999946, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D9.C1 = CFrame.new(0, -0.221999973, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D9.Part0 = Part3
- Motor6D9.Part1 = Part18
- Motor6D9.MaxVelocity = 0.10000000149012
- Part10.Name = "Left Leg"
- Part10.Parent = Model0
- Part10.Material = Enum.Material.DiamondPlate
- Part10.BrickColor = BrickColor.new("Dark green")
- Part10.Rotation = Vector3.new(0, -18.2399998, 0)
- Part10.RotVelocity = Vector3.new(-0.0160937011, -8.44836613e-05, 0.0028687357)
- Part10.Velocity = Vector3.new(-0.00443975534, 6.54769421, -0.0134364478)
- Part10.CanCollide = false
- Part10.FormFactor = Enum.FormFactor.Symmetric
- Part10.Size = Vector3.new(0.443999946, 0.887999892, 0.443999946)
- Part10.CFrame = CFrame.new(-15.0688667, 5.30917215, 26.913229, 0.949730039, 7.1851688e-13, -0.313070148, 3.12449421e-13, 0.999999881, 3.24291397e-12, 0.313070148, -3.1777107e-12, 0.949730039)
- Part10.BottomSurface = Enum.SurfaceType.Smooth
- Part10.TopSurface = Enum.SurfaceType.Smooth
- Part10.Color = Color3.new(0.156863, 0.498039, 0.278431)
- Part10.Position = Vector3.new(-15.0688667, 5.30917215, 26.913229)
- Part10.Orientation = Vector3.new(0, -18.2399998, 0)
- Part10.Color = Color3.new(0.156863, 0.498039, 0.278431)
- SpecialMesh11.Parent = Part10
- SpecialMesh11.MeshId = "rbxasset://fonts/leftleg.mesh"
- SpecialMesh11.Scale = Vector3.new(0.443999976, 0.443999976, 0.443999976)
- SpecialMesh11.MeshType = Enum.MeshType.FileMesh
- SpecialMesh11.Scale = Vector3.new(0.443999976, 0.443999976, 0.443999976)
- Part12.Name = "Right Leg"
- Part12.Parent = Model0
- Part12.Material = Enum.Material.DiamondPlate
- Part12.BrickColor = BrickColor.new("Dark green")
- Part12.Rotation = Vector3.new(0, -18.2399998, 0)
- Part12.RotVelocity = Vector3.new(-0.0160937011, -8.44836613e-05, 0.0028687357)
- Part12.Velocity = Vector3.new(-0.00445149839, 6.55114079, -0.0134008229)
- Part12.CanCollide = false
- Part12.FormFactor = Enum.FormFactor.Symmetric
- Part12.Size = Vector3.new(0.443999946, 0.887999892, 0.443999946)
- Part12.CFrame = CFrame.new(-14.6471863, 5.30917215, 27.0522327, 0.949730039, 7.1851688e-13, -0.313070148, 3.12449421e-13, 0.999999881, 3.24291397e-12, 0.313070148, -3.1777107e-12, 0.949730039)
- Part12.BottomSurface = Enum.SurfaceType.Smooth
- Part12.TopSurface = Enum.SurfaceType.Smooth
- Part12.Color = Color3.new(0.156863, 0.498039, 0.278431)
- Part12.Position = Vector3.new(-14.6471863, 5.30917215, 27.0522327)
- Part12.Orientation = Vector3.new(0, -18.2399998, 0)
- Part12.Color = Color3.new(0.156863, 0.498039, 0.278431)
- SpecialMesh13.Parent = Part12
- SpecialMesh13.MeshId = "rbxasset://fonts/leftleg.mesh"
- SpecialMesh13.Scale = Vector3.new(0.443999976, 0.443999976, 0.443999976)
- SpecialMesh13.MeshType = Enum.MeshType.FileMesh
- SpecialMesh13.Scale = Vector3.new(0.443999976, 0.443999976, 0.443999976)
- Part14.Name = "Left Arm"
- Part14.Parent = Model0
- Part14.Material = Enum.Material.DiamondPlate
- Part14.BrickColor = BrickColor.new("Bright yellow")
- Part14.Rotation = Vector3.new(179.899994, 18.2399998, 0.0299999993)
- Part14.RotVelocity = Vector3.new(-0.0160937011, -8.44836613e-05, 0.0028687357)
- Part14.Velocity = Vector3.new(-0.00824913848, 6.54424238, -0.0349088684)
- Part14.CanCollide = false
- Part14.FormFactor = Enum.FormFactor.Symmetric
- Part14.Size = Vector3.new(0.443999946, 0.887999892, 0.443999946)
- Part14.CFrame = CFrame.new(-15.4904356, 6.64117193, 26.7738895, 0.94972986, -0.000498579233, 0.31306985, 6.9924927e-11, -0.999998629, -0.00159254775, 0.313070178, 0.00151249045, -0.949728847)
- Part14.BottomSurface = Enum.SurfaceType.Smooth
- Part14.TopSurface = Enum.SurfaceType.Smooth
- Part14.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part14.Position = Vector3.new(-15.4904356, 6.64117193, 26.7738895)
- Part14.Orientation = Vector3.new(0.0899999961, 161.759995, 180)
- Part14.Color = Color3.new(0.960784, 0.803922, 0.188235)
- SpecialMesh15.Parent = Part14
- SpecialMesh15.MeshId = "rbxasset://fonts/leftleg.mesh"
- SpecialMesh15.Scale = Vector3.new(0.443999976, 0.443999976, 0.443999976)
- SpecialMesh15.MeshType = Enum.MeshType.FileMesh
- SpecialMesh15.Scale = Vector3.new(0.443999976, 0.443999976, 0.443999976)
- Part16.Name = "Right Arm"
- Part16.Parent = Model0
- Part16.Material = Enum.Material.DiamondPlate
- Part16.BrickColor = BrickColor.new("Bright yellow")
- Part16.Rotation = Vector3.new(179.899994, 18.2399998, 0.0299999993)
- Part16.RotVelocity = Vector3.new(-0.0160937011, -8.44836613e-05, 0.0028687357)
- Part16.Velocity = Vector3.new(-0.00828436855, 6.5545826, -0.0348019935)
- Part16.CanCollide = false
- Part16.FormFactor = Enum.FormFactor.Symmetric
- Part16.Size = Vector3.new(0.443999946, 0.887999892, 0.443999946)
- Part16.CFrame = CFrame.new(-14.2253962, 6.64117193, 27.1908989, 0.94972986, -0.000498579117, 0.313069671, -6.93000241e-11, -0.999998629, -0.00159254775, 0.313069999, 0.00151249045, -0.949728847)
- Part16.BottomSurface = Enum.SurfaceType.Smooth
- Part16.TopSurface = Enum.SurfaceType.Smooth
- Part16.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part16.Position = Vector3.new(-14.2253962, 6.64117193, 27.1908989)
- Part16.Orientation = Vector3.new(0.0899999961, 161.759995, -180)
- Part16.Color = Color3.new(0.960784, 0.803922, 0.188235)
- SpecialMesh17.Parent = Part16
- SpecialMesh17.MeshId = "rbxasset://fonts/leftleg.mesh"
- SpecialMesh17.Scale = Vector3.new(0.443999976, 0.443999976, 0.443999976)
- SpecialMesh17.MeshType = Enum.MeshType.FileMesh
- SpecialMesh17.Scale = Vector3.new(0.443999976, 0.443999976, 0.443999976)
- Part18.Name = "Head"
- Part18.Parent = Model0
- Part18.Material = Enum.Material.DiamondPlate
- Part18.BrickColor = BrickColor.new("Bright yellow")
- Part18.Rotation = Vector3.new(0, -18.2399998, 0)
- Part18.RotVelocity = Vector3.new(-0.0160937011, -8.44836613e-05, 0.0028687357)
- Part18.Velocity = Vector3.new(-0.00890364219, 6.5494175, -0.038428247)
- Part18.FormFactor = Enum.FormFactor.Symmetric
- Part18.Size = Vector3.new(0.887999892, 0.443999946, 0.443999946)
- Part18.CFrame = CFrame.new(-14.8580265, 6.86317205, 26.9827309, 0.949730039, 7.18516989e-13, -0.313070148, 3.12449421e-13, 1, 3.24291397e-12, 0.313070148, -3.17771113e-12, 0.949730039)
- Part18.BottomSurface = Enum.SurfaceType.Smooth
- Part18.TopSurface = Enum.SurfaceType.Smooth
- Part18.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part18.Position = Vector3.new(-14.8580265, 6.86317205, 26.9827309)
- Part18.Orientation = Vector3.new(0, -18.2399998, 0)
- Part18.Color = Color3.new(0.960784, 0.803922, 0.188235)
- SpecialMesh19.Parent = Part18
- SpecialMesh19.Scale = Vector3.new(1.25, 1.25, 1.25)
- SpecialMesh19.Scale = Vector3.new(1.25, 1.25, 1.25)
- Decal20.Name = "Face"
- Decal20.Parent = Part18
- Decal20.Texture = "rbxasset://textures/face.png"
- Sound21.Parent = Part18
- Sound21.Archivable = false
- Sound21.SoundId = "rbxasset://sounds/uuhhh.wav"
- Sound22.Parent = Part18
- Sound22.Archivable = false
- Sound22.SoundId = "rbxasset://sounds/splat.wav"
- Sound23.Parent = Part18
- Sound23.Archivable = false
- Sound23.SoundId = "rbxasset://sounds/swoosh.wav"
- Sound23.TimePosition = 0.034001454987447
- Sound24.Parent = Part18
- Sound24.Archivable = false
- Sound24.SoundId = "rbxasset://sounds/hit.wav"
- Sound25.Parent = Part18
- Sound25.Archivable = false
- Sound25.SoundId = "rbxasset://sounds/button.wav"
- Sound25.TimePosition = 0.015921851576422
- Sound26.Parent = Part18
- Sound26.Archivable = false
- Sound26.SoundId = "rbxasset://sounds/bfsl-minifigfoots1.mp3"
- Sound26.TimePosition = 0.016002419855795
- Sound26.Looped = true
- Humanoid27.Parent = Model0
- Humanoid27.NameOcclusion = Enum.NameOcclusion.NoOcclusion
- Humanoid27.RightLeg = Part12
- Humanoid27.LeftLeg = Part10
- Humanoid27.Torso = Part1
- Humanoid27.WalkToPoint = Vector3.new(-14.8579988, 2.64978838, 26.9664841)
- Color3Value28.Name = "Team"
- Color3Value28.Parent = Humanoid27
- Color3Value28.Value = Color3.new(0.156863, 0.498039, 0.278431)
- Script29.Name = "Sound"
- Script29.Parent = Model0
- table.insert(cors,sandbox(Script29,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))
- Model30.Name = "DebugPathDraw"
- Model30.Parent = Model0
- Script31.Name = "Animate"
- Script31.Parent = Model0
- table.insert(cors,sandbox(Script31,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))
- Backpack32.Name = "AI"
- Backpack32.Parent = Model0
- Script33.Name = "Pathfinding"
- Script33.Parent = Backpack32
- table.insert(cors,sandbox(Script33,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))
- BindableEvent34.Name = "MouseDown"
- BindableEvent34.Parent = Backpack32
- Script35.Name = "AutoJump"
- Script35.Parent = Backpack32
- table.insert(cors,sandbox(Script35,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))
- ObjectValue36.Name = "Target"
- ObjectValue36.Parent = Backpack32
- ObjectValue36.Value = nil
- AnimationController37.Parent = Model0
- Script38.Name = "Respawn"
- Script38.Parent = Model0
- table.insert(cors,sandbox(Script38,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