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")
- Weld2 = Instance.new("Weld")
- SpecialMesh3 = Instance.new("SpecialMesh")
- Decal4 = Instance.new("Decal")
- Part5 = Instance.new("Part")
- Decal6 = Instance.new("Decal")
- Motor6D7 = Instance.new("Motor6D")
- Motor6D8 = Instance.new("Motor6D")
- Motor6D9 = Instance.new("Motor6D")
- Motor6D10 = Instance.new("Motor6D")
- Motor6D11 = Instance.new("Motor6D")
- Sound12 = Instance.new("Sound")
- Sound13 = Instance.new("Sound")
- Sound14 = Instance.new("Sound")
- Part15 = Instance.new("Part")
- Part16 = Instance.new("Part")
- Part17 = Instance.new("Part")
- Script18 = Instance.new("Script")
- Part19 = Instance.new("Part")
- Script20 = Instance.new("Script")
- BoolValue21 = Instance.new("BoolValue")
- Script22 = Instance.new("Script")
- BoolValue23 = Instance.new("BoolValue")
- Humanoid24 = Instance.new("Humanoid")
- ObjectValue25 = Instance.new("ObjectValue")
- Script26 = Instance.new("Script")
- Script27 = Instance.new("Script")
- Script28 = Instance.new("Script")
- NumberValue29 = Instance.new("NumberValue")
- ObjectValue30 = Instance.new("ObjectValue")
- Animation31 = Instance.new("Animation")
- Script32 = Instance.new("Script")
- StringValue33 = Instance.new("StringValue")
- Animation34 = Instance.new("Animation")
- StringValue35 = Instance.new("StringValue")
- Animation36 = Instance.new("Animation")
- StringValue37 = Instance.new("StringValue")
- Animation38 = Instance.new("Animation")
- NumberValue39 = Instance.new("NumberValue")
- Animation40 = Instance.new("Animation")
- NumberValue41 = Instance.new("NumberValue")
- StringValue42 = Instance.new("StringValue")
- Animation43 = Instance.new("Animation")
- StringValue44 = Instance.new("StringValue")
- Animation45 = Instance.new("Animation")
- StringValue46 = Instance.new("StringValue")
- Animation47 = Instance.new("Animation")
- StringValue48 = Instance.new("StringValue")
- Animation49 = Instance.new("Animation")
- StringValue50 = Instance.new("StringValue")
- Animation51 = Instance.new("Animation")
- Pants52 = Instance.new("Pants")
- Shirt53 = Instance.new("Shirt")
- Model0.Name = "Zombie Yeti"
- Model0.Parent = mas
- Part1.Name = "Head"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(1.82991195, 9.15586472, -9.18083954, 0.996355772, 0, 0.0852946565, 0, 1, 0, -0.0852946565, 0, 0.996355772)
- Part1.Orientation = Vector3.new(0, 4.88999987, 0)
- Part1.Position = Vector3.new(1.82991195, 9.15586472, -9.18083954)
- Part1.Rotation = Vector3.new(0, 4.88999987, 0)
- Part1.Color = Color3.new(0.94902, 0.952941, 0.952941)
- Part1.Size = Vector3.new(4, 2, 2)
- Part1.BrickColor = BrickColor.new("White")
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("White")
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.formFactor = Enum.FormFactor.Symmetric
- Weld2.Name = "HeadWeld"
- Weld2.Parent = Part1
- Weld2.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld2.C1 = CFrame.new(0, 0.25, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- SpecialMesh3.Parent = Part1
- SpecialMesh3.Scale = Vector3.new(1.25, 1.25, 1.25)
- Decal4.Name = "Papyrus Face"
- Decal4.Parent = Part1
- Decal4.Texture = "http://www.roblox.com/asset/?id=785118827"
- Part5.Name = "Torso"
- Part5.Parent = Model0
- Part5.CFrame = CFrame.new(1.82991195, 6.00586462, -9.18083954, 0.996355772, 0, 0.0852946565, 0, 1, 0, -0.0852946565, 0, 0.996355772)
- Part5.Orientation = Vector3.new(0, 4.88999987, 0)
- Part5.Position = Vector3.new(1.82991195, 6.00586462, -9.18083954)
- Part5.Rotation = Vector3.new(0, 4.88999987, 0)
- Part5.Color = Color3.new(0.94902, 0.952941, 0.952941)
- Part5.Size = Vector3.new(4, 4, 2)
- Part5.BrickColor = BrickColor.new("White")
- Part5.LeftParamA = 0
- Part5.LeftParamB = 0
- Part5.LeftSurface = Enum.SurfaceType.Weld
- Part5.Material = Enum.Material.Ice
- Part5.RightParamA = 0
- Part5.RightParamB = 0
- Part5.RightSurface = Enum.SurfaceType.Weld
- Part5.brickColor = BrickColor.new("White")
- Part5.FormFactor = Enum.FormFactor.Symmetric
- Part5.formFactor = Enum.FormFactor.Symmetric
- Decal6.Name = "roblox"
- Decal6.Parent = Part5
- Motor6D7.Name = "Right Shoulder"
- Motor6D7.Parent = Part5
- Motor6D7.MaxVelocity = 0.15000000596046
- Motor6D7.CurrentAngle = 0.0076203746721148
- Motor6D7.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D7.C1 = CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D7.Part0 = Part5
- Motor6D7.Part1 = Part16
- Motor6D7.part1 = Part16
- Motor6D7.Transform = CFrame.new(1.22001254e-07, -0.00761091383, 4.07298216e-07, 0.999920011, -0.00761925755, 0.0100933062, 0.00762108574, 0.999970973, -0.000142632198, -0.010091926, 0.000219548383, 0.999949038)
- Motor6D8.Name = "Left Shoulder"
- Motor6D8.Parent = Part5
- Motor6D8.MaxVelocity = 0.15000000596046
- Motor6D8.CurrentAngle = -0.0062007796950638
- Motor6D8.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D8.C1 = CFrame.new(1.99999976, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D8.Part0 = Part5
- Motor6D8.Part1 = Part15
- Motor6D8.part1 = Part15
- Motor6D8.Transform = CFrame.new(2.48542165e-09, -0.0303637199, -1.39071901e-07, 0.999669731, 0.00622552261, -0.0249343365, -0.00617466308, 0.999978721, 0.0021163167, 0.0249469802, -0.00196166453, 0.999686897)
- Motor6D9.Name = "Right Hip"
- Motor6D9.Parent = Part5
- Motor6D9.MaxVelocity = 0.10000000149012
- Motor6D9.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D9.C1 = CFrame.new(0, 3, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D9.Part0 = Part5
- Motor6D9.Part1 = Part19
- Motor6D9.part1 = Part19
- Motor6D9.Transform = CFrame.new(0, 0.01449179, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D10.Name = "Left Hip"
- Motor6D10.Parent = Part5
- Motor6D10.MaxVelocity = 0.10000000149012
- Motor6D10.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D10.C1 = CFrame.new(0, 3, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D10.Part0 = Part5
- Motor6D10.Part1 = Part17
- Motor6D10.part1 = Part17
- Motor6D10.Transform = CFrame.new(0, 0.0179747958, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D11.Name = "Neck"
- Motor6D11.Parent = Part5
- Motor6D11.C1 = CFrame.new(0, 3.1500001, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D11.Part0 = Part1
- Motor6D11.Part1 = Part5
- Motor6D11.part1 = Part5
- Sound12.Parent = Part5
- Sound12.SoundId = "http://www.roblox.com/asset/?id=38212101"
- Sound12.Volume = 1
- Sound13.Parent = Part5
- Sound13.SoundId = "http://www.roblox.com/asset/?id=2801263"
- Sound13.Volume = 1
- Sound14.Parent = Part5
- Sound14.TimePosition = 7.7317870435846
- Sound14.Playing = true
- Sound14.SoundId = "rbxassetid://321451733"
- Sound14.Volume = 1
- Part15.Name = "Left Arm"
- Part15.Parent = Model0
- Part15.CFrame = CFrame.new(-1.16402745, 5.97974396, -8.97771358, 0.998170555, 0.00248551951, 0.0604104176, -0.0021163167, 0.999978721, -0.00617466308, -0.0604244843, 0.00603551604, 0.998154521)
- Part15.Orientation = Vector3.new(0.349999994, 3.46000004, -0.119999997)
- Part15.Position = Vector3.new(-1.16402745, 5.97974396, -8.97771358)
- Part15.Rotation = Vector3.new(0.349999994, 3.46000004, -0.140000001)
- Part15.Color = Color3.new(0.94902, 0.952941, 0.952941)
- Part15.Size = Vector3.new(2, 4, 2)
- Part15.BottomSurface = Enum.SurfaceType.Smooth
- Part15.BrickColor = BrickColor.new("White")
- Part15.CanCollide = false
- Part15.Material = Enum.Material.Ice
- Part15.brickColor = BrickColor.new("White")
- Part15.FormFactor = Enum.FormFactor.Symmetric
- Part15.formFactor = Enum.FormFactor.Symmetric
- Part16.Name = "Right Arm"
- Part16.Parent = Model0
- Part16.CFrame = CFrame.new(4.81672192, 5.99798298, -9.4606142, 0.995444059, 0.000868630246, 0.0953429788, -0.000142632198, 0.999970973, -0.00762108574, -0.0953468382, 0.007572765, 0.99541527)
- Part16.Orientation = Vector3.new(0.439999998, 5.46999979, -0.00999999978)
- Part16.Position = Vector3.new(4.81672192, 5.99798298, -9.4606142)
- Part16.Rotation = Vector3.new(0.439999998, 5.46999979, -0.049999997)
- Part16.Color = Color3.new(0.94902, 0.952941, 0.952941)
- Part16.Size = Vector3.new(2, 4, 2)
- Part16.BottomSurface = Enum.SurfaceType.Smooth
- Part16.BrickColor = BrickColor.new("White")
- Part16.CanCollide = false
- Part16.Material = Enum.Material.Ice
- Part16.brickColor = BrickColor.new("White")
- Part16.FormFactor = Enum.FormFactor.Symmetric
- Part16.formFactor = Enum.FormFactor.Symmetric
- Part17.Name = "Left Leg"
- Part17.Parent = Model0
- Part17.CFrame = CFrame.new(0.833556175, 2.02383947, -9.09554482, 0.996355772, 0, 0.0852946565, 0, 1, 0, -0.0852946565, 0, 0.996355772)
- Part17.Orientation = Vector3.new(0, 4.88999987, 0)
- Part17.Position = Vector3.new(0.833556175, 2.02383947, -9.09554482)
- Part17.Rotation = Vector3.new(0, 4.88999987, 0)
- Part17.Color = Color3.new(0.94902, 0.952941, 0.952941)
- Part17.Size = Vector3.new(2, 4, 2)
- Part17.BottomSurface = Enum.SurfaceType.Smooth
- Part17.BrickColor = BrickColor.new("White")
- Part17.CanCollide = false
- Part17.Material = Enum.Material.Ice
- Part17.brickColor = BrickColor.new("White")
- Part17.FormFactor = Enum.FormFactor.Symmetric
- Part17.formFactor = Enum.FormFactor.Symmetric
- Script18.Parent = Part17
- table.insert(cors,sandbox(Script18,function()
- function touch(hit)
- if hit.Parent.Name == "Tank" or hit.Parent.Name == "Brotherhood Of Scythe" then
- script.Parent.Parent.Humanoid.Jump = true
- end
- end
- script.Parent.Touched:connect(touch)
- while true do
- touch = script.Parent:findFirstChild("TouchInterest")
- if touch == nil then
- script.Parent.Touched:connect(touch)
- end
- wait()
- end
- end))
- Part19.Name = "Right Leg"
- Part19.Parent = Model0
- Part19.CFrame = CFrame.new(2.82626772, 2.02035642, -9.26613426, 0.996355772, 0, 0.0852946565, 0, 1, 0, -0.0852946565, 0, 0.996355772)
- Part19.Orientation = Vector3.new(0, 4.88999987, 0)
- Part19.Position = Vector3.new(2.82626772, 2.02035642, -9.26613426)
- Part19.Rotation = Vector3.new(0, 4.88999987, 0)
- Part19.Color = Color3.new(0.94902, 0.952941, 0.952941)
- Part19.Size = Vector3.new(2, 4, 2)
- Part19.BottomSurface = Enum.SurfaceType.Smooth
- Part19.BrickColor = BrickColor.new("White")
- Part19.CanCollide = false
- Part19.Material = Enum.Material.Ice
- Part19.brickColor = BrickColor.new("White")
- Part19.FormFactor = Enum.FormFactor.Symmetric
- Part19.formFactor = Enum.FormFactor.Symmetric
- Script20.Parent = Part19
- table.insert(cors,sandbox(Script20,function()
- function touch(hit)
- if hit.Parent.Name == "Tank" or hit.Parent.Name == "Brotherhood Of Scythe" then
- script.Parent.Parent.Humanoid.Jump = true
- end
- end
- script.Parent.Touched:connect(touch)
- while true do
- touch = script.Parent:findFirstChild("TouchInterest")
- if touch == nil then
- script.Parent.Touched:connect(touch)
- end
- wait()
- end
- end))
- BoolValue21.Name = "Attack"
- BoolValue21.Parent = Model0
- Script22.Name = "ChaseScript"
- Script22.Parent = Model0
- table.insert(cors,sandbox(Script22,function()
- wait()
- zombieParent = false
- while zombieParent == false do
- wait()
- if script.Parent.Name == "Zombie Yeti" then
- zombieParent = true
- end
- end
- local larm = script.Parent:FindFirstChild("Left Arm")
- local rarm = script.Parent:FindFirstChild("Right Arm")
- local waitTimer = 0
- function findNearestTorso(pos)
- local list = game.Workspace:children()
- local torso = nil
- local dist = 10000
- local temp = nil
- local human = nil
- local temp2 = nil
- for x = 1, #list do
- temp2 = list[x]
- if (temp2.className == "Model") and (temp2 ~= script.Parent) then
- temp = temp2:findFirstChild("Torso")
- human = temp2:findFirstChild("Humanoid")
- if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
- if (temp.Position - pos).magnitude < dist then
- torso = temp
- script.Parent.Target.Value = temp
- dist = (temp.Position - pos).magnitude
- if human.Health >= 1 then
- script.Parent.Range.Value = true
- else
- script.Parent.Range.Value = false
- end
- end
- end
- if dist < 10 then
- script.Parent.Attack.Value = true
- else
- script.Parent.Attack.Value = false
- end
- end
- end
- return torso
- end
- function Sit()
- if script.Parent.Zombie.Sit == true then
- script.Parent.Zombie.Jump = true
- print("Anti Seat Putter!!!")
- end
- end
- script.Parent.Zombie.Changed:connect(Sit)
- function touch(hit)
- if hit and hit.Parent then
- if hit.Parent.Name == "Ballista" or hit.Parent.Name == "Brotherhood Of Scythe" or hit.Parent.Name == "Jump" then
- script.Parent.Zombie.Jump = true
- end
- end
- end
- script.Parent["Right Leg"].Touched:connect(touch)
- script.Parent["Left Leg"].Touched:connect(touch)
- while true do
- wait(1)
- local target = findNearestTorso(script.Parent.Torso.Position)
- if target ~= nil then
- rx = math.random(-3,3)
- ry = math.random(0,0)
- rz = math.random(-3,3)
- script.Parent.Zombie:MoveTo(target.Position+Vector3.new(rx,ry,rz), target)
- else
- script.Parent.Range.Value = false
- script.Parent.Attack.Value = false
- end
- end
- end))
- BoolValue23.Name = "Range"
- BoolValue23.Parent = Model0
- Humanoid24.Name = "Zombie"
- Humanoid24.Parent = Model0
- Humanoid24.Health = 4752
- Humanoid24.LeftLeg = Part17
- Humanoid24.MaxHealth = 4752
- Humanoid24.NameOcclusion = Enum.NameOcclusion.NoOcclusion
- Humanoid24.RightLeg = Part19
- Humanoid24.Torso = Part5
- Humanoid24.WalkSpeed = 75
- Humanoid24.WalkToPart = nil
- Humanoid24.WalkToPoint = Vector3.new(0.999999106, -0.00134215667, -2)
- Humanoid24.maxHealth = 4752
- ObjectValue25.Name = "Target"
- ObjectValue25.Parent = Model0
- ObjectValue25.Value = nil
- Script26.Name = "Die"
- Script26.Parent = Model0
- table.insert(cors,sandbox(Script26,function()
- human = script.Parent.Zombie
- --tool = script.Parent.Pistol
- function Die()
- --if tool ~= nil then tool:remove() end
- wait(2.5)
- script.Parent:remove()
- end
- human.Died:connect(Die)
- end))
- Script27.Name = "ZombieScript"
- Script27.Parent = Model0
- table.insert(cors,sandbox(Script27,function()
- wait(1.5)
- local sp = script.Parent
- local Humanoid = sp:WaitForChild("Zombie")
- local Head = sp:WaitForChild("Head")
- local Torso = sp:WaitForChild("Torso")
- local Animation = script:WaitForChild("AttackAnim")
- local Yeti = Instance.new("Sound",Torso)
- Yeti.Volume = 1
- Yeti.SoundId = "http://www.roblox.com/asset/?id=38212101"
- Spawn(function() Yeti:Play() end)
- local Hit1 = Instance.new("Sound",Torso)
- Hit1.Volume = 1
- Hit1.SoundId = "http://www.roblox.com/asset/?id=2801263"
- local Hit2 = Instance.new("Sound",Torso)
- Hit2.Volume = 1
- Hit2.SoundId = "http://www.roblox.com/asset/?id=38212101"
- local AttackEnabled = true
- function wait(TimeToWait)
- if TimeToWait ~= nil then
- local TotalTime = 0
- TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
- while TotalTime < TimeToWait do
- TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
- end
- else
- game:GetService("RunService").Heartbeat:wait()
- end
- end
- function DamageTag(parent,damage)
- local DmgTag = script.DamageTag:clone()
- DmgTag.Damage.Value = damage
- DmgTag.creator.Value = game.Players.LocalPlayer
- DmgTag.Disabled = false
- DmgTag.Parent = parent
- end
- local Anim = Humanoid:LoadAnimation(Animation)
- function Hit(hit)
- local TargetHum = hit.Parent:FindFirstChild("Humanoid")
- if TargetHum ~= nil and TargetHum:IsA("Humanoid") and AttackEnabled == true and TargetHum ~= Humanoid then
- AttackEnabled = false
- Delay(0.5,function() AttackEnabled = true end)
- if Anim then Anim:Play(nil,nil,1.5) end
- DamageTag(TargetHum.Parent,125)
- Hit1:Play()
- Hit2:Play()
- end
- end
- for _, Child in pairs(script.Parent:GetChildren()) do
- if Child:IsA("Part") or Child:IsA("WedgePart") or Child:IsA("CornerWedgePart") then
- Child.Touched:connect(Hit)
- end
- end
- end))
- Script28.Name = "DamageTag"
- Script28.Parent = Script27
- table.insert(cors,sandbox(Script28,function()
- wait()
- h = script.Parent:findFirstChild("Humanoid")
- if h ~= nil then
- while h:findFirstChild("creator") do
- h.creator:Destroy()
- end
- tag = script.creator:clone()
- tag.Parent = h
- game.Debris:AddItem(tag,5)
- h:TakeDamage(script.Damage.Value)
- end
- script:remove()
- end))
- Script28.Disabled = true
- NumberValue29.Name = "Damage"
- NumberValue29.Parent = Script28
- ObjectValue30.Name = "creator"
- ObjectValue30.Parent = Script28
- Animation31.Name = "AttackAnim"
- Animation31.Parent = Script27
- Animation31.AnimationId = "http://www.roblox.com/Asset?ID=105211514"
- Script32.Name = "Animate"
- Script32.Parent = Model0
- table.insert(cors,sandbox(Script32,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
- 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 Zombie = waitForChild(Figure, "Zombie")
- local pose = "Standing"
- local currentAnim = ""
- local currentAnimInstance = nil
- local currentAnimTrack = nil
- local currentAnimKeyframeHandler = nil
- local currentAnimSpeed = 1.0
- local animTable = {}
- local animNames = {
- idle = {
- { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
- { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
- },
- walk = {
- { id = "http://www.roblox.com/asset/?id=180426354", weight = 10 }
- },
- run = {
- { id = "run.xml", weight = 10 }
- },
- jump = {
- { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
- },
- fall = {
- { id = "http://www.roblox.com/asset/?id=305752857", weight = 10 }
- },
- climb = {
- { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }
- },
- sit = {
- { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }
- },
- toolnone = {
- { id = "http://www.roblox.com/asset/?id=182393478", weight = 10 }
- },
- toolslash = {
- { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
- -- { id = "slash.xml", weight = 10 }
- },
- toollunge = {
- { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
- },
- wave = {
- { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
- },
- point = {
- { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
- },
- dance = {
- { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 }
- },
- dance2 = {
- { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 }
- },
- dance3 = {
- { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 }
- },
- laugh = {
- { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
- },
- cheer = {
- { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
- },
- }
- -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
- local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
- math.randomseed(tick())
- function configureAnimationSet(name, fileList)
- if (animTable[name] ~= nil) then
- for _, connection in pairs(animTable[name].connections) do
- connection:disconnect()
- end
- end
- animTable[name] = {}
- animTable[name].count = 0
- animTable[name].totalWeight = 0
- animTable[name].connections = {}
- -- check for config values
- local config = script:FindFirstChild(name)
- if (config ~= nil) then
- -- print("Loading anims " .. name)
- table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
- table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
- local idx = 1
- for _, childPart in pairs(config:GetChildren()) do
- if (childPart:IsA("Animation")) then
- table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
- animTable[name][idx] = {}
- animTable[name][idx].anim = childPart
- local weightObject = childPart:FindFirstChild("Weight")
- if (weightObject == nil) then
- animTable[name][idx].weight = 1
- else
- animTable[name][idx].weight = weightObject.Value
- end
- animTable[name].count = animTable[name].count + 1
- animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
- -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
- idx = idx + 1
- end
- end
- end
- -- fallback to defaults
- if (animTable[name].count <= 0) then
- for idx, anim in pairs(fileList) do
- animTable[name][idx] = {}
- animTable[name][idx].anim = Instance.new("Animation")
- animTable[name][idx].anim.Name = name
- animTable[name][idx].anim.AnimationId = anim.id
- animTable[name][idx].weight = anim.weight
- animTable[name].count = animTable[name].count + 1
- animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
- -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
- end
- end
- end
- -- Setup animation objects
- function scriptChildModified(child)
- local fileList = animNames[child.Name]
- if (fileList ~= nil) then
- configureAnimationSet(child.Name, fileList)
- end
- end
- script.ChildAdded:connect(scriptChildModified)
- script.ChildRemoved:connect(scriptChildModified)
- for name, fileList in pairs(animNames) do
- configureAnimationSet(name, fileList)
- end
- -- ANIMATION
- -- declarations
- local toolAnim = "None"
- local toolAnimTime = 0
- local jumpAnimTime = 0
- local jumpAnimDuration = 0.3
- local toolTransitionTime = 0.1
- local fallTransitionTime = 0.3
- local jumpMaxLimbVelocity = 0.75
- -- functions
- function stopAllAnimations()
- local oldAnim = currentAnim
- -- return to idle if finishing an emote
- if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
- oldAnim = "idle"
- end
- currentAnim = ""
- currentAnimInstance = nil
- if (currentAnimKeyframeHandler ~= nil) then
- currentAnimKeyframeHandler:disconnect()
- end
- if (currentAnimTrack ~= nil) then
- currentAnimTrack:Stop()
- currentAnimTrack:Destroy()
- currentAnimTrack = nil
- end
- return oldAnim
- end
- function setAnimationSpeed(speed)
- if speed ~= currentAnimSpeed then
- currentAnimSpeed = speed
- currentAnimTrack:AdjustSpeed(currentAnimSpeed)
- end
- end
- function keyFrameReachedFunc(frameName)
- if (frameName == "End") then
- local repeatAnim = currentAnim
- -- return to idle if finishing an emote
- if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
- repeatAnim = "idle"
- end
- local animSpeed = currentAnimSpeed
- playAnimation(repeatAnim, 0.0, Zombie)
- setAnimationSpeed(animSpeed)
- end
- end
- -- Preload animations
- function playAnimation(animName, transitionTime, Zombie)
- local roll = math.random(1, animTable[animName].totalWeight)
- local origRoll = roll
- local idx = 1
- while (roll > animTable[animName][idx].weight) do
- roll = roll - animTable[animName][idx].weight
- idx = idx + 1
- end
- -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
- local anim = animTable[animName][idx].anim
- -- switch animation
- if (anim ~= currentAnimInstance) then
- if (currentAnimTrack ~= nil) then
- currentAnimTrack:Stop(transitionTime)
- currentAnimTrack:Destroy()
- end
- currentAnimSpeed = 1.0
- -- load it to the Zombie; get AnimationTrack
- currentAnimTrack = Zombie:LoadAnimation(anim)
- -- play the animation
- currentAnimTrack:Play(transitionTime)
- currentAnim = animName
- currentAnimInstance = anim
- -- set up keyframe name triggers
- if (currentAnimKeyframeHandler ~= nil) then
- currentAnimKeyframeHandler:disconnect()
- end
- currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
- end
- end
- -------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------
- local toolAnimName = ""
- local toolAnimTrack = nil
- local toolAnimInstance = nil
- local currentToolAnimKeyframeHandler = nil
- function toolKeyFrameReachedFunc(frameName)
- if (frameName == "End") then
- -- print("Keyframe : ".. frameName)
- playToolAnimation(toolAnimName, 0.0, Zombie)
- end
- end
- function playToolAnimation(animName, transitionTime, Zombie)
- local roll = math.random(1, animTable[animName].totalWeight)
- local origRoll = roll
- local idx = 1
- while (roll > animTable[animName][idx].weight) do
- roll = roll - animTable[animName][idx].weight
- idx = idx + 1
- end
- -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
- local anim = animTable[animName][idx].anim
- if (toolAnimInstance ~= anim) then
- if (toolAnimTrack ~= nil) then
- toolAnimTrack:Stop()
- toolAnimTrack:Destroy()
- transitionTime = 0
- end
- -- load it to the Zombie; get AnimationTrack
- toolAnimTrack = Zombie:LoadAnimation(anim)
- -- play the animation
- toolAnimTrack:Play(transitionTime)
- toolAnimName = animName
- toolAnimInstance = anim
- currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
- end
- end
- function stopToolAnimations()
- local oldAnim = toolAnimName
- if (currentToolAnimKeyframeHandler ~= nil) then
- currentToolAnimKeyframeHandler:disconnect()
- end
- toolAnimName = ""
- toolAnimInstance = nil
- if (toolAnimTrack ~= nil) then
- toolAnimTrack:Stop()
- toolAnimTrack:Destroy()
- toolAnimTrack = nil
- end
- return oldAnim
- end
- -------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------
- function onRunning(speed)
- if speed>0.01 then
- playAnimation("walk", 0.1, Zombie)
- if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
- setAnimationSpeed(speed / 14.5)
- end
- pose = "Running"
- else
- playAnimation("idle", 0.1, Zombie)
- pose = "Standing"
- end
- end
- function onDied()
- pose = "Dead"
- end
- function onJumping()
- playAnimation("jump", 0.1, Zombie)
- jumpAnimTime = jumpAnimDuration
- pose = "Jumping"
- end
- function onClimbing(speed)
- playAnimation("climb", 0.1, Zombie)
- setAnimationSpeed(speed / 12.0)
- pose = "Climbing"
- end
- function onGettingUp()
- pose = "GettingUp"
- end
- function onFreeFall()
- if (jumpAnimTime <= 0) then
- playAnimation("fall", fallTransitionTime, Zombie)
- end
- 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 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
- playToolAnimation("toolnone", toolTransitionTime, Zombie)
- return
- end
- if (toolAnim == "Slash") then
- playToolAnimation("toolslash", 0, Zombie)
- return
- end
- if (toolAnim == "Lunge") then
- playToolAnimation("toollunge", 0, Zombie)
- return
- end
- 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
- local lastTick = 0
- function move(time)
- local amplitude = 1
- local frequency = 1
- local deltaTime = time - lastTick
- lastTick = time
- local climbFudge = 0
- local setAngles = false
- if (jumpAnimTime > 0) then
- jumpAnimTime = jumpAnimTime - deltaTime
- end
- if (pose == "FreeFall" and jumpAnimTime <= 0) then
- playAnimation("fall", fallTransitionTime, Zombie)
- elseif (pose == "Seated") then
- playAnimation("sit", 0.5, Zombie)
- return
- elseif (pose == "Running") then
- playAnimation("walk", 0.1, Zombie)
- elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
- -- print("Wha " .. pose)
- stopAllAnimations()
- amplitude = 0.1
- frequency = 1
- setAngles = true
- end
- if (setAngles) then
- desiredAngle = amplitude * math.sin(time * frequency)
- RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
- LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
- RightHip:SetDesiredAngle(-desiredAngle)
- LeftHip:SetDesiredAngle(-desiredAngle)
- end
- -- Tool Animation handling
- local tool = getTool()
- if tool and tool:FindFirstChild("Handle") 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
- stopToolAnimations()
- toolAnim = "None"
- toolAnimInstance = nil
- toolAnimTime = 0
- end
- end
- -- connect events
- Zombie.Died:connect(onDied)
- Zombie.Running:connect(onRunning)
- Zombie.Jumping:connect(onJumping)
- Zombie.Climbing:connect(onClimbing)
- Zombie.GettingUp:connect(onGettingUp)
- Zombie.FreeFalling:connect(onFreeFall)
- Zombie.FallingDown:connect(onFallingDown)
- Zombie.Seated:connect(onSeated)
- Zombie.PlatformStanding:connect(onPlatformStanding)
- Zombie.Swimming:connect(onSwimming)
- -- setup emote chat hook
- Game.Players.LocalPlayer.Chatted:connect(function(msg)
- local emote = ""
- if (string.sub(msg, 1, 3) == "/e ") then
- emote = string.sub(msg, 4)
- elseif (string.sub(msg, 1, 7) == "/emote ") then
- emote = string.sub(msg, 8)
- end
- if (pose == "Standing" and emoteNames[emote] ~= nil) then
- playAnimation(emote, 0.1, Zombie)
- end
- end)
- -- main program
- local runService = game:service("RunService");
- -- initialize to idle
- playAnimation("idle", 0.1, Zombie)
- pose = "Standing"
- while Figure.Parent~=nil do
- local _, time = wait(0.1)
- move(time)
- end
- end))
- StringValue33.Name = "climb"
- StringValue33.Parent = Script32
- Animation34.Name = "ClimbAnim"
- Animation34.Parent = StringValue33
- Animation34.AnimationId = "http://www.roblox.com/asset/?id=180436334"
- StringValue35.Name = "fall"
- StringValue35.Parent = Script32
- Animation36.Name = "FallAnim"
- Animation36.Parent = StringValue35
- Animation36.AnimationId = "http://www.roblox.com/asset/?id=180436148"
- StringValue37.Name = "idle"
- StringValue37.Parent = Script32
- Animation38.Name = "Animation1"
- Animation38.Parent = StringValue37
- Animation38.AnimationId = "http://www.roblox.com/asset/?id=180435571"
- NumberValue39.Name = "Weight"
- NumberValue39.Parent = Animation38
- NumberValue39.Value = 9
- Animation40.Name = "Animation2"
- Animation40.Parent = StringValue37
- Animation40.AnimationId = "http://www.roblox.com/asset/?id=180435792"
- NumberValue41.Name = "Weight"
- NumberValue41.Parent = Animation40
- NumberValue41.Value = 1
- StringValue42.Name = "jump"
- StringValue42.Parent = Script32
- Animation43.Name = "JumpAnim"
- Animation43.Parent = StringValue42
- Animation43.AnimationId = "http://www.roblox.com/asset/?id=125750702"
- StringValue44.Name = "run"
- StringValue44.Parent = Script32
- Animation45.Name = "RunAnim"
- Animation45.Parent = StringValue44
- Animation45.AnimationId = "http://www.roblox.com/asset/?id=180426354"
- StringValue46.Name = "sit"
- StringValue46.Parent = Script32
- Animation47.Name = "SitAnim"
- Animation47.Parent = StringValue46
- Animation47.AnimationId = "http://www.roblox.com/asset/?id=178130996"
- StringValue48.Name = "toolnone"
- StringValue48.Parent = Script32
- Animation49.Name = "ToolNoneAnim"
- Animation49.Parent = StringValue48
- Animation49.AnimationId = "http://www.roblox.com/asset/?id=182393478"
- StringValue50.Name = "walk"
- StringValue50.Parent = Script32
- Animation51.Name = "WalkAnim"
- Animation51.Parent = StringValue50
- Animation51.AnimationId = "http://www.roblox.com/asset/?id=180426354"
- Pants52.Name = "Pants"
- Pants52.Parent = Model0
- Pants52.PantsTemplate = "rbxassetid://949284975"
- Shirt53.Name = "Shirt"
- Shirt53.Parent = Model0
- Shirt53.ShirtTemplate = "rbxassetid://573188703"
- 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