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")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Decal3 = Instance.new("Decal")
- Part4 = Instance.new("Part")
- Motor5 = Instance.new("Motor")
- Snap6 = Instance.new("Snap")
- Motor7 = Instance.new("Motor")
- Motor8 = Instance.new("Motor")
- Motor9 = Instance.new("Motor")
- Part10 = Instance.new("Part")
- Part11 = Instance.new("Part")
- Humanoid12 = Instance.new("Humanoid")
- IntValue13 = Instance.new("IntValue")
- Part14 = Instance.new("Part")
- Part15 = Instance.new("Part")
- Script16 = Instance.new("Script")
- BodyColors17 = Instance.new("BodyColors")
- Pants18 = Instance.new("Pants")
- Shirt19 = Instance.new("Shirt")
- Script20 = Instance.new("Script")
- Script21 = Instance.new("Script")
- Humanoid22 = Instance.new("Humanoid")
- Script23 = Instance.new("Script")
- Script24 = Instance.new("Script")
- LocalScript25 = Instance.new("LocalScript")
- CharacterMesh26 = Instance.new("CharacterMesh")
- CharacterMesh27 = Instance.new("CharacterMesh")
- CharacterMesh28 = Instance.new("CharacterMesh")
- CharacterMesh29 = Instance.new("CharacterMesh")
- CharacterMesh30 = Instance.new("CharacterMesh")
- Model0.Name = "Security Gaurd"
- Model0.Parent = mas
- Part1.Name = "Head"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(32.5132179, 4.79862118, 2.34860468, -0.00713682175, 7.46813166e-05, 0.999974549, -0.000426594634, 0.999999881, -7.77277601e-05, -0.99997443, -0.000427138468, -0.00713670254)
- Part1.Orientation = Vector3.new(0, 90.409996, -0.0199999996)
- Part1.Position = Vector3.new(32.5132179, 4.79862118, 2.34860468)
- Part1.Rotation = Vector3.new(179.37999, 89.5899963, -179.399994)
- Part1.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part1.Size = Vector3.new(2, 1, 1)
- Part1.BrickColor = BrickColor.new("Light orange")
- Part1.CanCollide = false
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Light orange")
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.formFactor = Enum.FormFactor.Symmetric
- SpecialMesh2.Parent = Part1
- SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
- Decal3.Parent = Part1
- Decal3.Texture = "http://www.roblox.com/asset/?id=12117740"
- Part4.Name = "Torso"
- Part4.Parent = Model0
- Part4.CFrame = CFrame.new(32.5131073, 3.29862165, 2.34924531, -0.00713682175, 7.46813166e-05, 0.999974549, -0.000426594634, 0.999999881, -7.77277601e-05, -0.99997443, -0.000427138468, -0.00713670254)
- Part4.Orientation = Vector3.new(0, 90.409996, -0.0199999996)
- Part4.Position = Vector3.new(32.5131073, 3.29862165, 2.34924531)
- Part4.Rotation = Vector3.new(179.37999, 89.5899963, -179.399994)
- Part4.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part4.Size = Vector3.new(2, 2, 1)
- Part4.BrickColor = BrickColor.new("Light orange")
- Part4.CanCollide = false
- Part4.LeftParamA = 0
- Part4.LeftParamB = 0
- Part4.RightParamA = 0
- Part4.RightParamB = 0
- Part4.brickColor = BrickColor.new("Light orange")
- Part4.FormFactor = Enum.FormFactor.Symmetric
- Part4.formFactor = Enum.FormFactor.Symmetric
- Motor5.Name = "Left Hip"
- Motor5.Parent = Part4
- Motor5.MaxVelocity = 0.10000000149012
- Motor5.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor5.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- Motor5.Part0 = Part4
- Motor5.Part1 = Part10
- Motor5.part1 = Part10
- Motor5.DesiredAngle = 0.075219303369522
- Snap6.Name = "Neck"
- Snap6.Parent = Part4
- Snap6.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
- Snap6.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
- Motor7.Name = "Right Hip"
- Motor7.Parent = Part4
- Motor7.MaxVelocity = 0.10000000149012
- Motor7.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- Motor7.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- Motor7.Part0 = Part4
- Motor7.Part1 = Part11
- Motor7.part1 = Part11
- Motor7.DesiredAngle = 0.075219303369522
- Motor8.Name = "Right Shoulder"
- Motor8.Parent = Part4
- Motor8.MaxVelocity = 0.15000000596046
- Motor8.C0 = CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- Motor8.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- Motor8.Part0 = Part14
- Motor8.Part1 = Part4
- Motor8.part1 = Part4
- Motor8.DesiredAngle = 0.075219303369522
- Motor9.Name = "Left Shoulder"
- Motor9.Parent = Part4
- Motor9.MaxVelocity = 0.15000000596046
- Motor9.C0 = CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor9.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- Motor9.Part0 = Part15
- Motor9.Part1 = Part4
- Motor9.part1 = Part4
- Motor9.DesiredAngle = -0.075219303369522
- Part10.Name = "Left Leg"
- Part10.Parent = Model0
- Part10.CFrame = CFrame.new(32.5165253, 1.29883516, 2.85008669, -0.00713682175, 7.46813166e-05, 0.999974549, -0.000426594634, 0.999999881, -7.77277601e-05, -0.99997443, -0.000427138468, -0.00713670254)
- Part10.Orientation = Vector3.new(0, 90.409996, -0.0199999996)
- Part10.Position = Vector3.new(32.5165253, 1.29883516, 2.85008669)
- Part10.Rotation = Vector3.new(179.37999, 89.5899963, -179.399994)
- Part10.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part10.Size = Vector3.new(1, 2, 1)
- Part10.BottomSurface = Enum.SurfaceType.Smooth
- Part10.BrickColor = BrickColor.new("Light orange")
- Part10.CanCollide = false
- Part10.brickColor = BrickColor.new("Light orange")
- Part10.FormFactor = Enum.FormFactor.Symmetric
- Part10.formFactor = Enum.FormFactor.Symmetric
- Part11.Name = "Right Leg"
- Part11.Parent = Model0
- Part11.CFrame = CFrame.new(32.509388, 1.29840851, 1.85011244, -0.00713682175, 7.46813166e-05, 0.999974549, -0.000426594634, 0.999999881, -7.77277601e-05, -0.99997443, -0.000427138468, -0.00713670254)
- Part11.Orientation = Vector3.new(0, 90.409996, -0.0199999996)
- Part11.Position = Vector3.new(32.509388, 1.29840851, 1.85011244)
- Part11.Rotation = Vector3.new(179.37999, 89.5899963, -179.399994)
- Part11.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part11.Size = Vector3.new(1, 2, 1)
- Part11.BottomSurface = Enum.SurfaceType.Smooth
- Part11.BrickColor = BrickColor.new("Light orange")
- Part11.CanCollide = false
- Part11.brickColor = BrickColor.new("Light orange")
- Part11.FormFactor = Enum.FormFactor.Symmetric
- Part11.formFactor = Enum.FormFactor.Symmetric
- Humanoid12.Name = "Zombie"
- Humanoid12.Parent = Model0
- Humanoid12.LeftLeg = Part10
- Humanoid12.RightLeg = Part11
- Humanoid12.Torso = Part4
- Humanoid12.WalkSpeed = 30
- IntValue13.Name = "Mode"
- IntValue13.Parent = Model0
- Part14.Name = "Right Arm"
- Part14.Parent = Model0
- Part14.CFrame = CFrame.new(32.5024033, 3.29798174, 0.849283695, -0.00713682175, 7.46813166e-05, 0.999974549, -0.000426594634, 0.999999881, -7.77277601e-05, -0.99997443, -0.000427138468, -0.00713670254)
- Part14.Orientation = Vector3.new(0, 90.409996, -0.0199999996)
- Part14.Position = Vector3.new(32.5024033, 3.29798174, 0.849283695)
- Part14.Rotation = Vector3.new(179.37999, 89.5899963, -179.399994)
- Part14.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part14.Size = Vector3.new(1, 2, 1)
- Part14.BrickColor = BrickColor.new("Light orange")
- Part14.CanCollide = false
- Part14.TopSurface = Enum.SurfaceType.Smooth
- Part14.brickColor = BrickColor.new("Light orange")
- Part14.FormFactor = Enum.FormFactor.Symmetric
- Part14.formFactor = Enum.FormFactor.Symmetric
- Part15.Name = "Left Arm"
- Part15.Parent = Model0
- Part15.CFrame = CFrame.new(32.5238113, 3.29926157, 3.84920692, -0.00713682175, 7.46813166e-05, 0.999974549, -0.000426594634, 0.999999881, -7.77277601e-05, -0.99997443, -0.000427138468, -0.00713670254)
- Part15.Orientation = Vector3.new(0, 90.409996, -0.0199999996)
- Part15.Position = Vector3.new(32.5238113, 3.29926157, 3.84920692)
- Part15.Rotation = Vector3.new(179.37999, 89.5899963, -179.399994)
- Part15.Color = Color3.new(0.917647, 0.721569, 0.572549)
- Part15.Size = Vector3.new(1, 2, 1)
- Part15.BrickColor = BrickColor.new("Light orange")
- Part15.CanCollide = false
- Part15.TopSurface = Enum.SurfaceType.Smooth
- Part15.brickColor = BrickColor.new("Light orange")
- Part15.FormFactor = Enum.FormFactor.Symmetric
- Part15.formFactor = Enum.FormFactor.Symmetric
- Script16.Name = "Robot"
- Script16.Parent = Model0
- table.insert(cors,sandbox(Script16,function()
- model = script.Parent
- backup = model:Clone()
- regentime = 1 --5 minutes
- ------------------
- --SPAWNING--
- ------------------
- miked=script.Parent
- itlh=miked.Torso:findFirstChild("Left Hip")
- itlh.Part0=miked.Torso
- itlh.Part1=miked:findFirstChild("Left Leg")
- itlh.C0=CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- itrh=miked.Torso:findFirstChild("Right Hip")
- itrh.Part0=miked.Torso
- itrh.Part1=miked:findFirstChild("Right Leg")
- itrh.C0=CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- itls=miked.Torso:findFirstChild("Left Shoulder")
- itls.Part1=miked.Torso
- itls.C0=CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- itls.Part0=miked:findFirstChild("Left Arm")
- itrs=miked.Torso:findFirstChild("Right Shoulder")
- itrs.Part1=miked.Torso
- itrs.C0=CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- itrs.Part0=miked:findFirstChild("Right Arm")
- miked.Head:makeJoints()
- ------------------
- ------------------
- function waitForChild(parent, childName)
- while true do
- local child = parent:findFirstChild(childName)
- if child then
- return child
- end
- parent.ChildAdded:wait()
- end
- end
- 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, "Zombie")
- local pose = "Standing"
- local toolAnim = "None"
- local toolAnimTime = 0
- local isSeated = false
- function onRunning(speed)
- if isSeated then return end
- if speed>0 then
- pose = "Running"
- else
- pose = "Standing"
- end
- end
- function onDied()
- pose = "Dead"
- wait(regentime)
- wait(1)
- model:remove()
- model = backup:Clone()
- wait(3)
- model.Parent = game.Workspace
- model:MakeJoints()
- end
- function onJumping()
- isSeated = false
- pose = "Jumping"
- end
- function onClimbing()
- pose = "Climbing"
- end
- function onGettingUp()
- pose = "GettingUp"
- end
- function onFreeFall()
- pose = "FreeFall"
- end
- function onDancing()
- pose = "Dancing"
- end
- function onFallingDown()
- pose = "FallingDown"
- end
- function onSeated()
- isSeated = true
- pose = "Seated"
- end
- function moveJump()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -3.14
- LeftShoulder.DesiredAngle = -3.14
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function moveFreeFall()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -1
- LeftShoulder.DesiredAngle = -1
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function moveFloat()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -1.57
- LeftShoulder.DesiredAngle = 1.57
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = -1.57
- end
- function moveBoogy()
- while pose=="Boogy" do
- wait(.5)
- RightShoulder.MaxVelocity = 1
- LeftShoulder.MaxVelocity = 1
- RightShoulder.DesiredAngle = -3.14
- LeftShoulder.DesiredAngle = 0
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 0
- wait(.5)
- RightShoulder.MaxVelocity = 1
- LeftShoulder.MaxVelocity = 1
- RightShoulder.DesiredAngle = 0
- LeftShoulder.DesiredAngle = -3.14
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 1.57
- end
- end
- function moveZombie()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -1.57
- LeftShoulder.DesiredAngle = 1.57
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function movePunch()
- script.Parent.Torso.Anchored=true
- RightShoulder.MaxVelocity = 60
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -1.57
- LeftShoulder.DesiredAngle = 0
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- wait(1)
- script.Parent.Torso.Anchored=false
- pose="Standing"
- end
- function moveKick()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 0
- LeftShoulder.DesiredAngle = 0
- RightHip.MaxVelocity = 40
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 0
- wait(1)
- pose="Standing"
- end
- function moveFly()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 0
- LeftShoulder.DesiredAngle = 0
- RightHip.MaxVelocity = 40
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 0
- wait(1)
- pose="Standing"
- end
- function moveClimb()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -3.14
- LeftShoulder.DesiredAngle = 3.14
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function moveSit()
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- RightShoulder.DesiredAngle = -3.14 /2
- LeftShoulder.DesiredAngle = -3.14 /2
- RightHip.DesiredAngle = 3.14 /2
- LeftHip.DesiredAngle = -3.14 /2
- end
- function getTool()
- kidTable = Figure:children()
- if (kidTable ~= nil) then
- numKids = #kidTable
- for i=1,numKids do
- if (kidTable[i].className == "Tool") then return kidTable[i] end
- end
- end
- return nil
- end
- function getToolAnim(tool)
- c = tool:children()
- for i=1,#c do
- if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
- return c[i]
- end
- end
- return nil
- end
- function animateTool()
- if (toolAnim == "None") then
- RightShoulder.DesiredAngle = -1.57
- return
- end
- if (toolAnim == "Slash") then
- RightShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 0
- return
- end
- if (toolAnim == "Lunge") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightHip.MaxVelocity = 0.5
- LeftHip.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -1.57
- LeftShoulder.DesiredAngle = 1.0
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 1.0
- return
- end
- end
- function move(time)
- local amplitude
- local frequency
- if (pose == "Jumping") then
- moveJump()
- return
- end
- if (pose == "Zombie") then
- moveZombie()
- return
- end
- if (pose == "Boogy") then
- moveBoogy()
- return
- end
- if (pose == "Float") then
- moveFloat()
- return
- end
- if (pose == "Punch") then
- movePunch()
- return
- end
- if (pose == "Kick") then
- moveKick()
- return
- end
- if (pose == "Fly") then
- moveFly()
- return
- end
- if (pose == "FreeFall") then
- moveFreeFall()
- return
- end
- if (pose == "Climbing") then
- moveClimb()
- return
- end
- if (pose == "Seated") then
- moveSit()
- return
- end
- amplitude = 0.1
- frequency = 1
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- if (pose == "Running") then
- amplitude = 1
- frequency = 9
- elseif (pose == "Dancing") then
- amplitude = 2
- frequency = 16
- end
- desiredAngle = amplitude * math.sin(time*frequency)
- if pose~="Dancing" then
- RightShoulder.DesiredAngle = -desiredAngle
- LeftShoulder.DesiredAngle = desiredAngle
- RightHip.DesiredAngle = -desiredAngle
- LeftHip.DesiredAngle = -desiredAngle
- else
- RightShoulder.DesiredAngle = desiredAngle
- LeftShoulder.DesiredAngle = desiredAngle
- RightHip.DesiredAngle = -desiredAngle
- LeftHip.DesiredAngle = -desiredAngle
- end
- local tool = getTool()
- if tool ~= nil then
- animStringValueObject = getToolAnim(tool)
- if animStringValueObject ~= nil 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
- -----------------------------------------------------------------------------------------------------------------------
- function unequip()
- local items=script.Parent:children()
- for i=1, #items do
- if items[i].className=="Tool" then items[i]:remove() end
- end
- end
- function onChatted(msg, recipient)
- msg = string.lower(msg)
- if string.match(msg, string.lower(script.Parent.Name))~=nil or string.match(msg, "everyone") then
- if string.match(msg, "equip") then
- if game.Workspace:findFirstChild("Hub") then
- if string.match(msg, "rocket") then unequip()
- game.Workspace.Hub.Rocket:clone().Parent=script.Parent
- elseif string.match(msg, "slingshot") then unequip()
- game.Workspace.Hub.Slingshot:clone().Parent=script.Parent
- elseif string.match(msg, "sword") then unequip()
- game.Workspace.Hub.Sword:clone().Parent=script.Parent
- elseif string.match(msg, "pbg") then unequip()
- game.Workspace.Hub.PBG:clone().Parent=script.Parent
- elseif string.match(msg, "superball") then unequip()
- game.Workspace.Hub.Superball:clone().Parent=script.Parent
- elseif string.match(msg, "trowel") then unequip()
- game.Workspace.Hub.Trowel:clone().Parent=script.Parent
- elseif string.match(msg, "bomb") then unequip()
- game.Workspace.Hub.Bomb:clone().Parent=script.Parent
- end
- end
- end
- if string.match(msg, "unequip") then unequip() end
- if string.match(msg, "run") then onRunning(1) end
- if string.match(msg, "climb") then onClimbing() end
- if string.match(msg, "jump") then onJumping() end
- if string.match(msg, "zombie") then pose="Zombie" end
- if string.match(msg, "disco") then pose="Boogy" end
- if string.match(msg, "float") then pose="Float" end
- if string.match(msg, "punch") then pose="Punch" end
- if string.match(msg, "kick") then pose="Kick" end
- if string.match(msg, "fly") then pose="Fly" end
- if string.match(msg, "heal") then script.Parent.Humanoid.Health=script.Parent.Humanoid.MaxHealth end
- if string.match(msg, "defend") then defence() end
- if string.match(msg, "stop") then pose="Standing"; proxkill=false; following=false; stopmoving() end
- if string.match(msg, "go home") then following=false; gohome() end
- if string.match(msg, "follow") then
- if string.match(msg, "all") then
- followany()
- else
- local egg=game.Players:children()
- for i=1, #egg do
- if string.match(msg, string.lower(egg[i].Name)) then
- follow(egg[i].Name)
- return
- end
- end
- end
- end
- if string.match(msg, "kill") then
- if string.match(msg, "all") then
- attackany()
- else
- local egg=game.Players:children()
- for i=1, #egg do
- if string.match(msg, string.lower(egg[i].Name)) then
- attack(egg[i].Name)
- return
- end
- end
- end
- end
- end
- end
- if game.Players.NumPlayers>1 then
- x=game.Players:children()
- for i=1, #x do
- if script.Parent:findFirstChild("Commander")~=nil then
- if script.Parent.Commander:children()~=nil or script.Parent.Commander:children()>0 then
- local ch=script.Parent.Commander:children()
- for i=1, #ch do
- if string.lower(ch[i].Name)==string.lower(x[i].Name) then
- x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
- end
- end
- elseif string.lower(script.Parent.Commander.Value)==string.lower(x[i].Name) then
- x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
- end
- else
- x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
- end
- end
- end
- function onPlayerEntered(Player)
- while Player.Name==nil do
- wait(2)
- end
- if script.Parent:findFirstChild("Commander")~=nil then
- if script.Parent.Commander:children()~=nil or script.Parent.Commander:children()>0 then
- local ch=script.Parent.Commander:children()
- for i=1, #ch do
- if string.lower(ch[i].Name)==string.lower(Player.Name) then
- Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
- end
- end
- elseif string.lower(script.Parent.Commander.Value)==string.lower(Player.Name) then
- Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
- end
- else
- Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
- end
- end
- game.Players.ChildAdded:connect(onPlayerEntered)
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- dist=20
- function followany()
- following=true
- while following==true do
- local ch=game.Players:children()
- for i=1, #ch do
- local l=game.Workspace:findFirstChild(ch[i].Name)
- if l~=nil then
- local s=l.Torso
- local p=l.Torso.Position
- local q=script.Parent.Torso.Position
- local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
- if smallest==nil then
- smallest=d
- target=s
- elseif d<smallest then
- smallest=d
- target=s
- end
- end
- end
- if smallest==nil then stopmoving() return end
- if smallest>6*dist then return end
- script.Parent.Humanoid:MoveTo(target.Position, target)
- wait(0.5)
- for i=1, 6 do
- if target.Parent.Humanoid.Health<1 then stopmoving() else wait(0.5) end
- end
- end
- end
- function gohome()
- script.Parent.Humanoid:MoveTo(Vector3.new(0,0,0), game.Workspace.Bases.Base)
- end
- function stopmoving()
- script.Parent.Humanoid:MoveTo(script.Parent.Torso.Position, script.Parent.Torso)
- end
- function follow(name)
- following=true
- local p=game.Workspace:findFirstChild(name)
- if p==nil then return end
- while following==true do
- script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
- wait(0.5)
- for i=1, 3 do
- if p.Humanoid.Health<1 then following=false; stopmoving() return end
- wait(0.5)
- end
- end
- end
- function attack(name)
- if script.Parent:findFirstChild("Sword")~=nil then
- following=true
- local p=game.Workspace:findFirstChild(name)
- if p==nil then return end
- while following==true do
- script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
- wait(0.5)
- for i=1, 3 do
- if p.Humanoid.Health<1 then following=false; stopmoving() return end
- local l=p.Torso.Position
- local q=script.Parent.Torso.Position
- local d=math.sqrt( ((l.x-q.x)^2)+((l.y-q.y)^2)+((l.z-q.z)^2) )
- if d<10 then
- script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso); slash()
- if (q.y-l.y)>3 and (q.y-l.y)<7 then
- script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
- end
- end
- wait(1)
- end
- end
- end
- end
- function attackany()
- if script.Parent:findFirstChild("Sword")~=nil then
- following=true
- while following==true do
- local ch=game.Players:children()
- for i=1, #ch do
- local l=game.Workspace:findFirstChild(ch[i].Name)
- if l~=nil then
- local s=l.Torso
- local p=l.Torso.Position
- local q=script.Parent.Torso.Position
- local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
- if smallest==nil then
- smallest=d
- target=s
- elseif d<smallest then
- smallest=d
- target=s
- end
- end
- end
- if smallest==nil then stopmoving() return end
- if smallest>6*dist then return end
- script.Parent.Humanoid:MoveTo(target.Position, target)
- if smallest<10 then
- slash()
- end
- if target.Parent==nil then stopmoving() return end
- wait(0.5)
- for i=1, 3 do
- if target.Parent.Humanoid.Health<1 then
- stopmoving()
- else
- local p=target.Position
- local q=script.Parent.Torso.Position
- local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
- if d<10 then
- script.Parent.Humanoid:MoveTo(target.Position, target); slash()
- if (q.y-p.y)>3 and (q.y-p.y)<7 then
- script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
- end
- end
- wait(1)
- end
- end
- end
- end
- end
- function patrol()
- if points==nil then
- points=0
- if game.Workspace:findFirstChild("pp1")~=nil then
- pp1=game.Workspace:findFirstChild("pp1")
- local points=points+1
- if game.Workspace:findFirstChild("pp2")~=nil then
- pp2=game.Workspace:findFirstChild("pp2")
- local points=points+1
- if game.Workspace:findFirstChild("pp3")~=nil then
- pp3=game.Workspace:findFirstChild("pp3")
- local points=points+1
- if game.Workspace:findFirstChild("pp4")~=nil then
- pp4=game.Workspace:findFirstChild("pp4")
- local points=points+1
- if game.Workspace:findFirstChild("pp5")~=nil then
- pp5=game.Workspace:findFirstChild("pp5")
- local points=points+1
- if game.Workspace:findFirstChild("pp6")~=nil then
- pp6=game.Workspace:findFirstChild("pp6")
- local points=points+1
- if game.Workspace:findFirstChild("pp7")~=nil then
- pp7=game.Workspace:findFirstChild("pp7")
- local points=points+1
- if game.Workspace:findFirstChild("pp8")~=nil then
- pp8=game.Workspace:findFirstChild("pp8")
- local points=points+1
- if game.Workspace:findFirstChild("pp9")~=nil then
- pp9=game.Workspace:findFirstChild("pp9")
- local points=points+1
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- if points<1 then return end
- patrolling=true
- local time=2
- if points==1 then return end
- if points>1 then
- while patrolling==true do
- script.Parent.Humanoid:MoveTo(pp1.Position, pp1)
- wait(time)
- script.Parent.Humanoid:MoveTo(pp2.Position, pp2)
- wait(time)
- if points>2 then
- script.Parent.Humanoid:MoveTo(pp3.Position, pp3)
- wait(time)
- if points>3 then
- script.Parent.Humanoid:MoveTo(pp4.Position, pp4)
- wait(time)
- if points>4 then
- script.Parent.Humanoid:MoveTo(pp5.Position, pp5)
- wait(time)
- if points>5 then
- script.Parent.Humanoid:MoveTo(pp6.Position, pp6)
- wait(time)
- if points>6 then
- script.Parent.Humanoid:MoveTo(pp7.Position, pp7)
- wait(time)
- if points>7 then
- script.Parent.Humanoid:MoveTo(pp8.Position, pp8)
- wait(time)
- if points>8 then
- script.Parent.Humanoid:MoveTo(pp9.Position, pp9)
- wait(time)
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- function goto(pos,part)
- while true do
- end
- end
- function slash()
- for i=1, 3 do
- wait(.3)
- RightShoulder.MaxVelocity = 2
- LeftShoulder.MaxVelocity = 1
- RightShoulder.DesiredAngle = -2.14
- LeftShoulder.DesiredAngle = 0
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- wait(.2)
- RightShoulder.MaxVelocity = 2
- LeftShoulder.MaxVelocity = 1
- RightShoulder.DesiredAngle = 0
- LeftShoulder.DesiredAngle = 0
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- end
- function defence()
- proxkill=true
- while proxkill==true do
- local ch=game.Players:children()
- for i=1, #ch do
- local p=game.Workspace:findFirstChild(ch[i].Name)
- if p~=nil then
- local p=p.Torso.Position
- local q=script.Parent.Torso.Position
- local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
- if d<dist and d>8 then
- local ex=Instance.new("Explosion")
- ex.Position=p
- ex.Parent=game.Workspace
- end
- end
- end
- wait(1)
- end
- end
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------------------------------------------------------------------------
- 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)
- --[[
- function newSound(id)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- 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>0 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)
- --]]
- local nextTime = 0
- local runService = game:service("RunService");
- while Figure.Parent~=nil do
- time = runService.Stepped:wait()
- if time > nextTime then
- move(time)
- nextTime = time + 0.1
- end
- end
- end))
- BodyColors17.Parent = Model0
- BodyColors17.HeadColor = BrickColor.new("Light orange")
- BodyColors17.HeadColor3 = Color3.new(0.917647, 0.721569, 0.572549)
- BodyColors17.LeftArmColor = BrickColor.new("Light orange")
- BodyColors17.LeftArmColor3 = Color3.new(0.917647, 0.721569, 0.572549)
- BodyColors17.LeftLegColor = BrickColor.new("Light orange")
- BodyColors17.LeftLegColor3 = Color3.new(0.917647, 0.721569, 0.572549)
- BodyColors17.RightArmColor = BrickColor.new("Light orange")
- BodyColors17.RightArmColor3 = Color3.new(0.917647, 0.721569, 0.572549)
- BodyColors17.RightLegColor = BrickColor.new("Light orange")
- BodyColors17.RightLegColor3 = Color3.new(0.917647, 0.721569, 0.572549)
- BodyColors17.TorsoColor = BrickColor.new("Light orange")
- BodyColors17.TorsoColor3 = Color3.new(0.917647, 0.721569, 0.572549)
- Pants18.Name = "Pants"
- Pants18.Parent = Model0
- Pants18.PantsTemplate = "http://www.roblox.com/asset/?id=37234899"
- Shirt19.Name = "Shirt"
- Shirt19.Parent = Model0
- Shirt19.ShirtTemplate = "http://www.roblox.com/asset/?id=29703292"
- Script20.Name = "Health"
- Script20.Parent = Model0
- table.insert(cors,sandbox(Script20,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
- -- declarations
- local Figure = script.Parent
- local Head = waitForChild(Figure, "Head")
- local Humanoid = waitForChild(Figure, "Humanoid")
- -- regeneration
- while true do
- local s = wait(1)
- local health = Humanoid.Health
- if health > 0 and health < Humanoid.MaxHealth then
- health = health + 0.01 * s * Humanoid.MaxHealth
- if health * 1.05 < Humanoid.MaxHealth then
- Humanoid.Health = health
- else
- Humanoid.Health = Humanoid.MaxHealth
- end
- end
- end
- end))
- Script21.Name = "HealthScript v2.0"
- Script21.Parent = Model0
- table.insert(cors,sandbox(Script21,function()
- local humanoid = script.Parent.Humanoid
- if (humanoid == nil) then
- print("ERROR: no humanoid found in 'HealthScript v2.0'")
- end
- function CreateGUI()
- local p = game.Players:GetPlayerFromCharacter(humanoid.Parent)
- print("Health for Player: " .. p.Name)
- script.HealthGUI.Parent = p.PlayerGui
- end
- function UpdateGUI(health)
- local pgui = game.Players:GetPlayerFromCharacter(humanoid.Parent).PlayerGui
- local tray = pgui.HealthGUI.Tray
- tray.HealthBar.Size = UDim2.new(0.2, 0, 0.8 * (health / humanoid.MaxHealth), 0)
- tray.HealthBar.Position = UDim2.new(0.4, 0, 0.8 * (1- (health / humanoid.MaxHealth)) , 0)
- end
- function HealthChanged(health)
- UpdateGUI(health)
- end
- CreateGUI()
- humanoid.HealthChanged:connect(HealthChanged)
- humanoid.Died:connect(function() HealthChanged(0) end)
- end))
- Humanoid22.Parent = Model0
- Humanoid22.LeftLeg = Part10
- Humanoid22.RightLeg = Part11
- Humanoid22.Torso = Part4
- Script23.Name = "RobloxTeam"
- Script23.Parent = Model0
- table.insert(cors,sandbox(Script23,function()
- -- Now with exciting TeamColors HACK!
- 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
- -- TEAM COLORS
- function onTeamChanged(player)
- wait(1)
- local char = player.Character
- if char == nil then return end
- if player.Neutral then
- -- Replacing the current BodyColor object will force a reset
- local old = char:findFirstChild("Body Colors")
- if not old then return end
- old:clone().Parent = char
- old.Parent = nil
- else
- local head = char:findFirstChild("Head")
- local torso = char:findFirstChild("Torso")
- local left_arm = char:findFirstChild("Left Arm")
- local right_arm = char:findFirstChild("Right Arm")
- local left_leg = char:findFirstChild("Left Leg")
- local right_leg = char:findFirstChild("Right Leg")
- if head then head.BrickColor = BrickColor.new(24) end
- if torso then torso.BrickColor = player.TeamColor end
- if left_arm then left_arm.BrickColor = BrickColor.new(26) end
- if right_arm then right_arm.BrickColor = BrickColor.new(26) end
- if left_leg then left_leg.BrickColor = BrickColor.new(26) end
- if right_leg then right_leg.BrickColor = BrickColor.new(26) end
- end
- end
- function onPlayerPropChanged(property, player)
- if property == "Character" then
- onTeamChanged(player)
- end
- if property== "TeamColor" or property == "Neutral" then
- onTeamChanged(player)
- end
- end
- local cPlayer = game.Players:GetPlayerFromCharacter(script.Parent)
- cPlayer.Changed:connect(function(property) onPlayerPropChanged(property, cPlayer) end )
- onTeamChanged(cPlayer)
- end))
- Script24.Name = "Sound"
- Script24.Parent = Model0
- table.insert(cors,sandbox(Script24,function()
- -- util
- 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
- -- declarations
- 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")
- -- functions
- function onDied()
- sDied:Play()
- end
- function onState(state, sound)
- if state then
- sound:Play()
- else
- sound:Pause()
- end
- end
- function onRunning(speed)
- if speed>0 then
- sRunning:Play()
- else
- sRunning:Pause()
- end
- end
- -- connect up
- 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))
- LocalScript25.Name = "Animate"
- LocalScript25.Parent = Model0
- table.insert(cors,sandbox(LocalScript25,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
- -- functions
- function onRunning(speed)
- if speed>0 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 moveJump()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 3.14
- LeftShoulder.DesiredAngle = -3.14
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- -- same as jump for now
- function moveFreeFall()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 3.14
- LeftShoulder.DesiredAngle = -3.14
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function moveSit()
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- RightShoulder.DesiredAngle = 3.14 /2
- LeftShoulder.DesiredAngle = -3.14 /2
- RightHip.DesiredAngle = 3.14 /2
- LeftHip.DesiredAngle = -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.DesiredAngle = 1.57
- return
- end
- if (toolAnim == "Slash") then
- RightShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 0
- return
- end
- if (toolAnim == "Lunge") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightHip.MaxVelocity = 0.5
- LeftHip.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 1.57
- LeftShoulder.DesiredAngle = 1.0
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 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
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- 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.DesiredAngle = desiredAngle + climbFudge
- LeftShoulder.DesiredAngle = desiredAngle - climbFudge
- RightHip.DesiredAngle = -desiredAngle
- LeftHip.DesiredAngle = -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)
- -- main program
- local runService = game:service("RunService");
- while Figure.Parent~=nil do
- local _, time = wait(0.1)
- move(time)
- end
- end))
- CharacterMesh26.Name = "Roblox 2.0 Right Leg"
- CharacterMesh26.Parent = Model0
- CharacterMesh26.BodyPart = Enum.BodyPart.RightLeg
- CharacterMesh26.MeshId = 27111882
- CharacterMesh27.Name = "Roblox 2.0 Right Arm"
- CharacterMesh27.Parent = Model0
- CharacterMesh27.BodyPart = Enum.BodyPart.RightArm
- CharacterMesh27.MeshId = 27111864
- CharacterMesh28.Name = "Roblox 2.0 Left Leg"
- CharacterMesh28.Parent = Model0
- CharacterMesh28.BodyPart = Enum.BodyPart.LeftLeg
- CharacterMesh28.MeshId = 27111857
- CharacterMesh29.Name = "Roblox 2.0 Left Arm"
- CharacterMesh29.Parent = Model0
- CharacterMesh29.BodyPart = Enum.BodyPart.LeftArm
- CharacterMesh29.MeshId = 27111419
- CharacterMesh30.Name = "Roblox 2.0 torso"
- CharacterMesh30.Parent = Model0
- CharacterMesh30.BodyPart = Enum.BodyPart.Torso
- CharacterMesh30.MeshId = 27111894
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = script
- 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