Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,Mouse,mouse,UserInputService,ContextActionService = owner
- local RealPlayer = Player
- do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end,__call=function(self,...)local t=rawget(self,"_RealService")if t then return t(...)end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return self[t]end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;x.RunService=v({RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")setmetatable(x,{__index=function(self,t)return r:GetService(t)or typeof(r[t])=="function"and function(m,...)return r[t](r,...)end or r[t]end,__newindex=s.__newindex,__call=s.__call})game,owner=x,x.Players.LocalPlayer end
- --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")
- Part4 = Instance.new("Part")
- Decal5 = Instance.new("Decal")
- Motor6D6 = Instance.new("Motor6D")
- Motor6D7 = Instance.new("Motor6D")
- Motor6D8 = Instance.new("Motor6D")
- Motor6D9 = Instance.new("Motor6D")
- Motor6D10 = Instance.new("Motor6D")
- Part11 = Instance.new("Part")
- Part12 = Instance.new("Part")
- Part13 = Instance.new("Part")
- Script14 = Instance.new("Script")
- Part15 = Instance.new("Part")
- Script16 = Instance.new("Script")
- BoolValue17 = Instance.new("BoolValue")
- Script18 = Instance.new("Script")
- BoolValue19 = Instance.new("BoolValue")
- Humanoid20 = Instance.new("Humanoid")
- ObjectValue21 = Instance.new("ObjectValue")
- Script22 = Instance.new("Script")
- Script23 = Instance.new("Script")
- Script24 = Instance.new("Script")
- NumberValue25 = Instance.new("NumberValue")
- ObjectValue26 = Instance.new("ObjectValue")
- Animation27 = Instance.new("Animation")
- Script28 = Instance.new("Script")
- StringValue29 = Instance.new("StringValue")
- Animation30 = Instance.new("Animation")
- StringValue31 = Instance.new("StringValue")
- Animation32 = Instance.new("Animation")
- StringValue33 = Instance.new("StringValue")
- Animation34 = Instance.new("Animation")
- NumberValue35 = Instance.new("NumberValue")
- Animation36 = Instance.new("Animation")
- NumberValue37 = Instance.new("NumberValue")
- StringValue38 = Instance.new("StringValue")
- Animation39 = Instance.new("Animation")
- StringValue40 = Instance.new("StringValue")
- Animation41 = Instance.new("Animation")
- StringValue42 = Instance.new("StringValue")
- Animation43 = Instance.new("Animation")
- StringValue44 = Instance.new("StringValue")
- Animation45 = Instance.new("Animation")
- StringValue46 = Instance.new("StringValue")
- Animation47 = Instance.new("Animation")
- Camera48 = Instance.new("Camera")
- Model0.Name = "Zombie Yeti"
- Model0.Parent = mas
- Part1.Name = "Head"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(-6.13871002, 9.14999771, -11.4352522, -0.999999821, 1.33315838e-08, -2.98023224e-08, 1.33315865e-08, 1, 4.03998524e-09, 2.98023224e-08, 4.03997991e-09, -0.999999821)
- Part1.Orientation = Vector3.new(0, -180, 0)
- Part1.Position = Vector3.new(-6.13871002, 9.14999771, -11.4352522)
- Part1.Rotation = Vector3.new(-180, 0, -180)
- 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.MeshId = "http://www.roblox.com/asset/?id=22149649"
- SpecialMesh3.Scale = Vector3.new(2, 2, 2)
- SpecialMesh3.TextureId = "http://www.roblox.com/asset/?id=22149641"
- SpecialMesh3.MeshType = Enum.MeshType.FileMesh
- Part4.Name = "Torso"
- Part4.Parent = Model0
- Part4.CFrame = CFrame.new(-6.13871002, 5.99999809, -11.4352522, -0.999999821, 1.33315838e-08, -2.98023224e-08, 1.33315865e-08, 1, 4.03998524e-09, 2.98023224e-08, 4.03997991e-09, -0.999999821)
- Part4.Orientation = Vector3.new(0, -180, 0)
- Part4.Position = Vector3.new(-6.13871002, 5.99999809, -11.4352522)
- Part4.Rotation = Vector3.new(-180, 0, -180)
- Part4.Color = Color3.new(0.94902, 0.952941, 0.952941)
- Part4.Size = Vector3.new(4, 4, 2)
- Part4.BrickColor = BrickColor.new("White")
- Part4.LeftParamA = 0
- Part4.LeftParamB = 0
- Part4.LeftSurface = Enum.SurfaceType.Weld
- Part4.Material = Enum.Material.Ice
- Part4.RightParamA = 0
- Part4.RightParamB = 0
- Part4.RightSurface = Enum.SurfaceType.Weld
- Part4.brickColor = BrickColor.new("White")
- Part4.FormFactor = Enum.FormFactor.Symmetric
- Part4.formFactor = Enum.FormFactor.Symmetric
- Decal5.Name = "roblox"
- Decal5.Parent = Part4
- Motor6D6.Name = "Right Shoulder"
- Motor6D6.Parent = Part4
- Motor6D6.MaxVelocity = 0.15000000596046
- Motor6D6.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D6.C1 = CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D6.Part0 = Part4
- Motor6D6.Part1 = Part12
- Motor6D6.part1 = Part12
- Motor6D7.Name = "Left Shoulder"
- Motor6D7.Parent = Part4
- Motor6D7.MaxVelocity = 0.15000000596046
- Motor6D7.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D7.C1 = CFrame.new(1.99999976, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D7.Part0 = Part4
- Motor6D7.Part1 = Part11
- Motor6D7.part1 = Part11
- Motor6D8.Name = "Right Hip"
- Motor6D8.Parent = Part4
- Motor6D8.MaxVelocity = 0.10000000149012
- Motor6D8.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D8.C1 = CFrame.new(0, 3, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D8.Part0 = Part4
- Motor6D8.Part1 = Part15
- Motor6D8.part1 = Part15
- Motor6D9.Name = "Left Hip"
- Motor6D9.Parent = Part4
- 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 = Part4
- Motor6D9.Part1 = Part13
- Motor6D9.part1 = Part13
- Motor6D10.Name = "Neck"
- Motor6D10.Parent = Part4
- Motor6D10.C1 = CFrame.new(0, 3.1500001, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D10.Part0 = Part1
- Motor6D10.Part1 = Part4
- Motor6D10.part1 = Part4
- Part11.Name = "Left Arm"
- Part11.Parent = Model0
- Part11.CFrame = CFrame.new(-3.13871074, 5.99999809, -11.4352522, -0.999999821, 1.33315838e-08, -2.98023224e-08, 1.33315865e-08, 1, 4.03998524e-09, 2.98023224e-08, 4.03997991e-09, -0.999999821)
- Part11.Orientation = Vector3.new(0, -180, 0)
- Part11.Position = Vector3.new(-3.13871074, 5.99999809, -11.4352522)
- Part11.Rotation = Vector3.new(-180, 0, -180)
- Part11.Color = Color3.new(0.94902, 0.952941, 0.952941)
- Part11.Size = Vector3.new(2, 4, 2)
- Part11.BottomSurface = Enum.SurfaceType.Smooth
- Part11.BrickColor = BrickColor.new("White")
- Part11.CanCollide = false
- Part11.Material = Enum.Material.Ice
- Part11.brickColor = BrickColor.new("White")
- Part11.FormFactor = Enum.FormFactor.Symmetric
- Part11.formFactor = Enum.FormFactor.Symmetric
- Part12.Name = "Right Arm"
- Part12.Parent = Model0
- Part12.CFrame = CFrame.new(-9.13871002, 5.99999809, -11.4352522, -0.999999821, 1.33315838e-08, -2.98023224e-08, 1.33315865e-08, 1, 4.03998524e-09, 2.98023224e-08, 4.03997991e-09, -0.999999821)
- Part12.Orientation = Vector3.new(0, -180, 0)
- Part12.Position = Vector3.new(-9.13871002, 5.99999809, -11.4352522)
- Part12.Rotation = Vector3.new(-180, 0, -180)
- Part12.Color = Color3.new(0.94902, 0.952941, 0.952941)
- Part12.Size = Vector3.new(2, 4, 2)
- Part12.BottomSurface = Enum.SurfaceType.Smooth
- Part12.BrickColor = BrickColor.new("White")
- Part12.CanCollide = false
- Part12.Material = Enum.Material.Ice
- Part12.brickColor = BrickColor.new("White")
- Part12.FormFactor = Enum.FormFactor.Symmetric
- Part12.formFactor = Enum.FormFactor.Symmetric
- Part13.Name = "Left Leg"
- Part13.Parent = Model0
- Part13.CFrame = CFrame.new(-5.13871002, 1.99999809, -11.4352522, -0.999999821, 1.33315838e-08, -2.98023224e-08, 1.33315865e-08, 1, 4.03998524e-09, 2.98023224e-08, 4.03997991e-09, -0.999999821)
- Part13.Orientation = Vector3.new(0, -180, 0)
- Part13.Position = Vector3.new(-5.13871002, 1.99999809, -11.4352522)
- Part13.Rotation = Vector3.new(-180, 0, -180)
- Part13.Color = Color3.new(0.94902, 0.952941, 0.952941)
- Part13.Size = Vector3.new(2, 4, 2)
- Part13.BottomSurface = Enum.SurfaceType.Smooth
- Part13.BrickColor = BrickColor.new("White")
- Part13.CanCollide = false
- Part13.Material = Enum.Material.Ice
- Part13.brickColor = BrickColor.new("White")
- Part13.FormFactor = Enum.FormFactor.Symmetric
- Part13.formFactor = Enum.FormFactor.Symmetric
- Script14.Parent = Part13
- table.insert(cors,sandbox(Script14,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))
- Part15.Name = "Right Leg"
- Part15.Parent = Model0
- Part15.CFrame = CFrame.new(-7.13871002, 1.99999809, -11.4352522, -0.999999821, 1.33315838e-08, -2.98023224e-08, 1.33315865e-08, 1, 4.03998524e-09, 2.98023224e-08, 4.03997991e-09, -0.999999821)
- Part15.Orientation = Vector3.new(0, -180, 0)
- Part15.Position = Vector3.new(-7.13871002, 1.99999809, -11.4352522)
- Part15.Rotation = Vector3.new(-180, 0, -180)
- 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
- Script16.Parent = Part15
- table.insert(cors,sandbox(Script16,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))
- BoolValue17.Name = "Attack"
- BoolValue17.Parent = Model0
- Script18.Name = "ChaseScript"
- Script18.Parent = Model0
- table.insert(cors,sandbox(Script18,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))
- BoolValue19.Name = "Range"
- BoolValue19.Parent = Model0
- Humanoid20.Name = "Zombie"
- Humanoid20.Parent = Model0
- Humanoid20.Health = 4752
- Humanoid20.LeftLeg = Part13
- Humanoid20.MaxHealth = 4752
- Humanoid20.NameOcclusion = Enum.NameOcclusion.NoOcclusion
- Humanoid20.RightLeg = Part15
- Humanoid20.Torso = Part4
- Humanoid20.WalkSpeed = 75
- Humanoid20.maxHealth = 4752
- ObjectValue21.Name = "Target"
- ObjectValue21.Parent = Model0
- Script22.Name = "Die"
- Script22.Parent = Model0
- table.insert(cors,sandbox(Script22,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))
- Script23.Name = "ZombieScript"
- Script23.Parent = Model0
- table.insert(cors,sandbox(Script23,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,workspace)
- 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))
- Script24.Name = "DamageTag"
- Script24.Parent = Script23
- table.insert(cors,sandbox(Script24,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))
- Script24.Disabled = true
- NumberValue25.Name = "Damage"
- NumberValue25.Parent = Script24
- ObjectValue26.Name = "creator"
- ObjectValue26.Parent = Script24
- Animation27.Name = "AttackAnim"
- Animation27.Parent = Script23
- Animation27.AnimationId = "http://www.roblox.com/Asset?ID=105211514"
- Script28.Name = "Animate"
- Script28.Parent = Model0
- table.insert(cors,sandbox(Script28,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))
- StringValue29.Name = "climb"
- StringValue29.Parent = Script28
- Animation30.Name = "ClimbAnim"
- Animation30.Parent = StringValue29
- Animation30.AnimationId = "http://www.roblox.com/asset/?id=180436334"
- StringValue31.Name = "fall"
- StringValue31.Parent = Script28
- Animation32.Name = "FallAnim"
- Animation32.Parent = StringValue31
- Animation32.AnimationId = "http://www.roblox.com/asset/?id=180436148"
- StringValue33.Name = "idle"
- StringValue33.Parent = Script28
- Animation34.Name = "Animation1"
- Animation34.Parent = StringValue33
- Animation34.AnimationId = "http://www.roblox.com/asset/?id=180435571"
- NumberValue35.Name = "Weight"
- NumberValue35.Parent = Animation34
- NumberValue35.Value = 9
- Animation36.Name = "Animation2"
- Animation36.Parent = StringValue33
- Animation36.AnimationId = "http://www.roblox.com/asset/?id=180435792"
- NumberValue37.Name = "Weight"
- NumberValue37.Parent = Animation36
- NumberValue37.Value = 1
- StringValue38.Name = "jump"
- StringValue38.Parent = Script28
- Animation39.Name = "JumpAnim"
- Animation39.Parent = StringValue38
- Animation39.AnimationId = "http://www.roblox.com/asset/?id=125750702"
- StringValue40.Name = "run"
- StringValue40.Parent = Script28
- Animation41.Name = "RunAnim"
- Animation41.Parent = StringValue40
- Animation41.AnimationId = "http://www.roblox.com/asset/?id=180426354"
- StringValue42.Name = "sit"
- StringValue42.Parent = Script28
- Animation43.Name = "SitAnim"
- Animation43.Parent = StringValue42
- Animation43.AnimationId = "http://www.roblox.com/asset/?id=178130996"
- StringValue44.Name = "toolnone"
- StringValue44.Parent = Script28
- Animation45.Name = "ToolNoneAnim"
- Animation45.Parent = StringValue44
- Animation45.AnimationId = "http://www.roblox.com/asset/?id=182393478"
- StringValue46.Name = "walk"
- StringValue46.Parent = Script28
- Animation47.Name = "WalkAnim"
- Animation47.Parent = StringValue46
- Animation47.AnimationId = "http://www.roblox.com/asset/?id=180426354"
- Camera48.Name = "ThumbnailCamera"
- Camera48.Parent = Model0
- Camera48.CFrame = CFrame.new(-120.427315, 8.9444809, -67.5636902, 0.6640172, 0.0586584844, -0.745412886, 3.7252903e-09, 0.996918142, 0.0784500837, 0.747717321, -0.0520922095, 0.661970794)
- Camera48.CoordinateFrame = CFrame.new(-120.427315, 8.9444809, -67.5636902, 0.6640172, 0.0586584844, -0.745412886, 3.7252903e-09, 0.996918142, 0.0784500837, 0.747717321, -0.0520922095, 0.661970794)
- Camera48.Focus = CFrame.new(-118.936478, 8.78757954, -68.8876419, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Camera48.focus = CFrame.new(-118.936478, 8.78757954, -68.8876419, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- 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