Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Created with PenguinAnonymous's compiler
- --PenguinAnonymous is not responsible for damages caused to your game
- --This plugin does not remove things
- --PenguinAnonymous cannot be held resonsible for manual deletion for the purpose of testing
- --Keep in mind, any items that cause errors in compilation will be skipped and documented within the last line of the disclaimer comments
- --Thank you for using my plugin and enjoy :)
- --It is free to use
- --If you use this plugin to create your own, please give me credit
- --Z_V edited my plugin to look like his own and published it without giving me credit, and that makes me very angry
- --Errors: Camera
- local runDummyScript = function(f,scri)
- local oldenv = getfenv(f)
- local newenv = setmetatable({}, {
- __index = function(_, k)
- if k:lower() == 'script' then
- return scri
- else
- return oldenv[k]
- end
- end
- })
- setfenv(f, newenv)
- ypcall(function() f() end)
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- mas.Name = "CompiledModel"
- o1 = Instance.new("Model")
- o2 = Instance.new("Part")
- o3 = Instance.new("SpecialMesh")
- o4 = Instance.new("Sound")
- o5 = Instance.new("Sound")
- o6 = Instance.new("Sound")
- o7 = Instance.new("Sound")
- o8 = Instance.new("Sound")
- o9 = Instance.new("Sound")
- o10 = Instance.new("Sound")
- o11 = Instance.new("Sound")
- o12 = Instance.new("Sound")
- o13 = Instance.new("Sound")
- o14 = Instance.new("Part")
- o15 = Instance.new("Motor6D")
- o16 = Instance.new("Part")
- o17 = Instance.new("Part")
- o18 = Instance.new("Part")
- o19 = Instance.new("Part")
- o20 = Instance.new("Humanoid")
- o21 = Instance.new("Model")
- o22 = Instance.new("Part")
- o23 = Instance.new("Decal")
- o24 = Instance.new("Motor6D")
- o25 = Instance.new("Motor6D")
- o26 = Instance.new("Motor6D")
- o27 = Instance.new("Motor6D")
- o28 = Instance.new("Motor6D")
- o29 = Instance.new("Animation")
- o30 = Instance.new("Shirt")
- o31 = Instance.new("CharacterMesh")
- o32 = Instance.new("CharacterMesh")
- o33 = Instance.new("Pants")
- o34 = Instance.new("Script")
- o35 = Instance.new("CharacterMesh")
- o36 = Instance.new("CharacterMesh")
- o37 = Instance.new("CharacterMesh")
- o38 = Instance.new("Script")
- o39 = Instance.new("StringValue")
- o40 = Instance.new("Animation")
- o41 = Instance.new("StringValue")
- o42 = Instance.new("Animation")
- o43 = Instance.new("StringValue")
- o44 = Instance.new("Animation")
- o45 = Instance.new("NumberValue")
- o46 = Instance.new("Animation")
- o47 = Instance.new("NumberValue")
- o48 = Instance.new("StringValue")
- o49 = Instance.new("Animation")
- o50 = Instance.new("StringValue")
- o51 = Instance.new("Animation")
- o52 = Instance.new("StringValue")
- o53 = Instance.new("Animation")
- o54 = Instance.new("StringValue")
- o55 = Instance.new("Animation")
- o56 = Instance.new("StringValue")
- o57 = Instance.new("Animation")
- o58 = Instance.new("BodyColors")
- o1.Name = "Twitcher"
- o1.Parent = mas
- o1.PrimaryPart = o2
- o2.Name = "Head"
- o2.Parent = o1
- o2.BrickColor = BrickColor.new("Sand red")
- o2.Position = Vector3.new(-33.9538841, 4.3830204, -158)
- o2.Rotation = Vector3.new(0, 0, -40)
- o2.CanCollide = false
- o2.Locked = true
- o2.Elasticity = 0
- o2.FormFactor = Enum.FormFactor.Symmetric
- o2.Friction = 2
- o2.Size = Vector3.new(2, 1, 1)
- o2.CFrame = CFrame.new(-33.9538841, 4.3830204, -158, 0.766044438, 0.642787576, 0, -0.642787576, 0.766044438, 0, 0, 0, 1)
- o2.TopSurface = Enum.SurfaceType.Smooth
- o2.Color = Color3.new(0.584314, 0.47451, 0.466667)
- o2.Position = Vector3.new(-33.9538841, 4.3830204, -158)
- o3.Parent = o2
- o3.MeshId = "http://www.roblox.com/asset/?id=17392637"
- o3.TextureId = "http://www.roblox.com/asset/?id=187752481"
- o3.MeshType = Enum.MeshType.FileMesh
- o4.Name = "zo_pain2"
- o4.Parent = o2
- o4.SoundId = "http://www.roblox.com/asset/?id=187645851"
- o4.Volume = 1
- o5.Name = "zo_clawstrike1"
- o5.Parent = o2
- o5.SoundId = "rbxassetid://187645424"
- o5.Volume = 1
- o6.Name = "zo_clawstrike2"
- o6.Parent = o2
- o6.SoundId = "rbxassetid://187645448"
- o6.Volume = 1
- o7.Name = "zo_clawstrike3"
- o7.Parent = o2
- o7.SoundId = "rbxassetid://187645481"
- o7.Volume = 1
- o8.Name = "zo_attack1"
- o8.Parent = o2
- o8.SoundId = "rbxassetid://187645787"
- o8.Volume = 1
- o9.Name = "zo_attack2"
- o9.Parent = o2
- o9.SoundId = "rbxassetid://187645811"
- o9.Volume = 1
- o10.Name = "zo_alert10"
- o10.Parent = o2
- o10.SoundId = "http://www.roblox.com/asset/?id=187645728"
- o10.Volume = 1
- o11.Name = "zo_alert20"
- o11.Parent = o2
- o11.SoundId = "http://www.roblox.com/asset/?id=187645755"
- o11.Volume = 1
- o12.Name = "zo_alert30"
- o12.Parent = o2
- o12.SoundId = "http://www.roblox.com/asset/?id=187645778"
- o12.Volume = 1
- o13.Name = "zo_pain1"
- o13.Parent = o2
- o13.SoundId = "http://www.roblox.com/asset/?id=187645836"
- o13.Volume = 1
- o14.Name = "HumanoidRootPart"
- o14.Parent = o1
- o14.BrickColor = BrickColor.new("Bright blue")
- o14.Transparency = 1
- o14.Position = Vector3.new(-34, 2.99999905, -158)
- o14.Anchored = true
- o14.CanCollide = false
- o14.Locked = true
- o14.Elasticity = 0
- o14.FormFactor = Enum.FormFactor.Symmetric
- o14.Friction = 2
- o14.Size = Vector3.new(2, 2, 1)
- o14.CFrame = CFrame.new(-34, 2.99999905, -158, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- o14.BottomSurface = Enum.SurfaceType.Smooth
- o14.TopSurface = Enum.SurfaceType.Smooth
- o14.Color = Color3.new(0.0509804, 0.411765, 0.67451)
- o14.Position = Vector3.new(-34, 2.99999905, -158)
- o15.Name = "RootJoint"
- o15.Parent = o14
- o15.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- o15.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- o15.Part0 = o14
- o15.Part1 = o22
- o15.MaxVelocity = 0.10000000149012
- o16.Name = "Right Leg"
- o16.Parent = o1
- o16.BrickColor = BrickColor.new("Brick yellow")
- o16.Position = Vector3.new(-33.4924049, 0.999999046, -158.086823)
- o16.Rotation = Vector3.new(0, -10, 0)
- o16.CanCollide = false
- o16.Locked = true
- o16.Elasticity = 0
- o16.FormFactor = Enum.FormFactor.Symmetric
- o16.Friction = 2
- o16.Size = Vector3.new(1, 2, 1)
- o16.CFrame = CFrame.new(-33.4924049, 0.999999046, -158.086823, 0.984807789, 0, -0.17364797, 0, 1, 0, 0.17364797, 0, 0.984807789)
- o16.BottomSurface = Enum.SurfaceType.Smooth
- o16.Color = Color3.new(0.843137, 0.772549, 0.603922)
- o16.Position = Vector3.new(-33.4924049, 0.999999046, -158.086823)
- o17.Name = "Left Leg"
- o17.Parent = o1
- o17.BrickColor = BrickColor.new("Brick yellow")
- o17.Position = Vector3.new(-34.5075951, 0.999999046, -158.086823)
- o17.Rotation = Vector3.new(0, 10, 0)
- o17.CanCollide = false
- o17.Locked = true
- o17.Elasticity = 0
- o17.FormFactor = Enum.FormFactor.Symmetric
- o17.Friction = 2
- o17.Size = Vector3.new(1, 2, 1)
- o17.CFrame = CFrame.new(-34.5075951, 0.999999046, -158.086823, 0.98480773, 0, 0.173648149, 0, 1, 0, -0.173648149, 0, 0.98480773)
- o17.BottomSurface = Enum.SurfaceType.Smooth
- o17.Color = Color3.new(0.843137, 0.772549, 0.603922)
- o17.Position = Vector3.new(-34.5075951, 0.999999046, -158.086823)
- o18.Name = "Right Arm"
- o18.Parent = o1
- o18.BrickColor = BrickColor.new("Black")
- o18.Position = Vector3.new(-32.3169861, 3.34150577, -158.091507)
- o18.Rotation = Vector3.new(30, 0, 30)
- o18.CanCollide = false
- o18.Locked = true
- o18.Elasticity = 0
- o18.FormFactor = Enum.FormFactor.Symmetric
- o18.Friction = 2
- o18.Size = Vector3.new(1, 2, 1)
- o18.CFrame = CFrame.new(-32.3169861, 3.34150577, -158.091507, 0.866025388, -0.5, 0, 0.433012694, 0.75, -0.5, 0.25, 0.433012694, 0.866025388)
- o18.Color = Color3.new(0.105882, 0.164706, 0.207843)
- o18.Position = Vector3.new(-32.3169861, 3.34150577, -158.091507)
- o19.Name = "Left Arm"
- o19.Parent = o1
- o19.BrickColor = BrickColor.new("Black")
- o19.Position = Vector3.new(-35.6830139, 3.34150434, -158.091507)
- o19.Rotation = Vector3.new(30, 0, -30)
- o19.CanCollide = false
- o19.Locked = true
- o19.Elasticity = 0
- o19.FormFactor = Enum.FormFactor.Symmetric
- o19.Friction = 2
- o19.Size = Vector3.new(1, 2, 1)
- o19.CFrame = CFrame.new(-35.6830139, 3.34150434, -158.091507, 0.866025388, 0.5, 2.53130317e-09, -0.433012664, 0.74999994, -0.500000179, -0.250000089, 0.433012843, 0.866025329)
- o19.Color = Color3.new(0.105882, 0.164706, 0.207843)
- o19.Position = Vector3.new(-35.6830139, 3.34150434, -158.091507)
- o20.Parent = o1
- o20.NameOcclusion = Enum.NameOcclusion.EnemyOcclusion
- o20.RightLeg = o16
- o20.LeftLeg = o17
- o20.Torso = o14
- o20.Health = 150
- o20.MaxHealth = 150
- o20.WalkSpeed = 30
- o21.Name = "Status"
- o21.Parent = o20
- o22.Name = "Torso"
- o22.Parent = o1
- o22.BrickColor = BrickColor.new("Black")
- o22.Position = Vector3.new(-34, 2.99999905, -158)
- o22.CanCollide = false
- o22.Locked = true
- o22.Elasticity = 0
- o22.FormFactor = Enum.FormFactor.Symmetric
- o22.Friction = 2
- o22.Size = Vector3.new(2, 2, 1)
- o22.CFrame = CFrame.new(-34, 2.99999905, -158, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- o22.LeftSurface = Enum.SurfaceType.Weld
- o22.RightSurface = Enum.SurfaceType.Weld
- o22.Color = Color3.new(0.105882, 0.164706, 0.207843)
- o22.Position = Vector3.new(-34, 2.99999905, -158)
- o23.Name = "roblox"
- o23.Parent = o22
- o23.Texture = "http://www.roblox.com/asset/?id=47730520"
- o24.Name = "Right Shoulder"
- o24.Parent = o22
- o24.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- o24.C1 = CFrame.new(-0.500000954, 0.5, 0, -0.25, 0.433012694, 0.866025388, -0.433012694, 0.75, -0.5, -0.866025388, -0.5, 0)
- o24.Part0 = o22
- o24.Part1 = o18
- o24.MaxVelocity = 0.10000000149012
- o25.Name = "Left Shoulder"
- o25.Parent = o22
- o25.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- o25.C1 = CFrame.new(0.499999046, 0.500000954, 0, -0.250000089, -0.433012664, -0.866025388, 0.433012843, 0.74999994, -0.5, 0.866025329, -0.500000179, -2.53130317e-09)
- o25.Part0 = o22
- o25.Part1 = o19
- o25.MaxVelocity = 0.10000000149012
- o26.Name = "Right Hip"
- o26.Parent = o22
- o26.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- o26.C1 = CFrame.new(0.5, 1, 0, -0.17364797, 0, 0.984807789, 0, 1, 0, -0.984807789, 0, -0.17364797)
- o26.Part0 = o22
- o26.Part1 = o16
- o26.MaxVelocity = 0.10000000149012
- o27.Name = "Left Hip"
- o27.Parent = o22
- o27.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- o27.C1 = CFrame.new(-0.500000954, 1, 0, -0.173648149, 0, -0.98480773, 0, 1, 0, 0.98480773, 0, -0.173648149)
- o27.Part0 = o22
- o27.Part1 = o17
- o27.MaxVelocity = 0.10000000149012
- o28.Name = "Neck"
- o28.Parent = o22
- o28.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- o28.C1 = CFrame.new(0.210875511, -0.32305336, 0, -0.766044438, 0, -0.642787576, -0.642787576, 0, 0.766044438, 0, 1, 0)
- o28.Part0 = o22
- o28.Part1 = o2
- o28.MaxVelocity = 0.10000000149012
- o29.Name = "CloseAttackAnim"
- o29.Parent = o1
- o29.AnimationId = "rbxassetid://94160738"
- o30.Name = "Shirt"
- o30.Parent = o1
- o30.ShirtTemplate = "rbxassetid://187751943"
- o31.Name = "Roblox 2.0 Right Leg"
- o31.Parent = o1
- o31.MeshId = 27111882
- o31.BodyPart = Enum.BodyPart.RightLeg
- o32.Name = "Roblox 2.0 torso"
- o32.Parent = o1
- o32.MeshId = 27111894
- o32.BodyPart = Enum.BodyPart.Torso
- o33.Name = "Pants"
- o33.Parent = o1
- o33.PantsTemplate = "rbxassetid://187752312"
- o34.Name = "TwitcherTargetScript"
- o34.Parent = o1
- table.insert(cors,coroutine.create(function()
- wait()
- runDummyScript(function()
- --[[ By: Brutez ]]--
- local TwitcherMainScript = script;
- local Twitcher = TwitcherMainScript.Parent;
- local Head = Twitcher:FindFirstChild("Head");
- local HumanoidRootPart = Twitcher:FindFirstChild("HumanoidRootPart");
- local LeftArm = Twitcher:FindFirstChild("Left Arm");
- local LeftLeg = Twitcher:FindFirstChild("Left Leg");
- local RightArm = Twitcher:FindFirstChild("Right Arm");
- local RightLeg = Twitcher:FindFirstChild("Right Leg");
- local Torso = Twitcher:FindFirstChild("Torso");
- local TwitcherHumanoid = Twitcher:FindFirstChild("Humanoid");
- local AxeIsOut = false;
- local AxeEnabled = true;
- local TwitcherAttackAnimation = TwitcherHumanoid:LoadAnimation(Twitcher.CloseAttackAnim);
- local TwitcherAlertSounds = {Head.zo_alert10,Head.zo_alert20,Head.zo_alert30};
- local TwitcherAttackSounds = {Head.zo_attack1,Head.zo_attack2};
- local TwitcherClawStrikeSounds = {Head.zo_clawstrike1,Head.zo_clawstrike2,Head.zo_clawstrike3};
- local TwitcherPainSounds = {Head.zo_pain1,Head.zo_pain2};
- repeat Wait(0) until TwitcherHumanoid ~= nil
- repeat TwitcherHumanoid:TakeDamage(10) TwitcherHumanoid.Health = TwitcherHumanoid.MaxHealth Wait(0) until TwitcherHumanoid.Health == TwitcherHumanoid.MaxHealth
- local SpawnForceField = Instance.new("ForceField")
- SpawnForceField.Name = "SpawnForceField"
- SpawnForceField.Parent = Twitcher
- function FollowTarget(TargetHumanoid, TargetTorso)
- if not TargetHumanoid or not TargetHumanoid.Parent or TargetHumanoid.Health == 0 or not TargetTorso or not TargetTorso.Parent then
- return
- end
- local TwitcherRadiusXAxis = math.random(-2,2)
- local TwitcherRadiusYAxis = math.random(-2,2)
- local TwitcherRadiusZAxis = math.random(-2,2)
- TwitcherHumanoid:MoveTo(TargetTorso.Position+Vector3.new(TwitcherRadiusXAxis,TwitcherRadiusYAxis,TwitcherRadiusZAxis), TargetTorso)
- end
- function ThunderAttack(TargetHumanoid, TargetTorso)
- if not TargetHumanoid or not TargetHumanoid.Parent or TargetHumanoid.Health == 0 or not TargetTorso or not TargetTorso.Parent then
- return
- end
- local TwitcherDamage = 5
- TwitcherAttackSounds[math.random(1,#TwitcherAttackSounds)]:Play()
- TwitcherHumanoid.WalkSpeed = 0
- Wait(0.3)
- TwitcherClawStrikeSounds[math.random(1,#TwitcherClawStrikeSounds)]:Play()
- if TargetTorso~=nil and(Torso.Position-TargetTorso.Position).magnitude<=7 then
- TargetHumanoid:TakeDamage(TwitcherDamage)
- end
- TwitcherAttackAnimation:Play();
- TwitcherAttackAnimation:AdjustSpeed(1.5);
- Wait(0.4)
- TwitcherAttackAnimation:Play();
- TwitcherAttackAnimation:AdjustSpeed(1.5);
- TwitcherClawStrikeSounds[math.random(1,#TwitcherClawStrikeSounds)]:Play()
- if TargetTorso~=nil and(Torso.Position-TargetTorso.Position).magnitude<=7 then
- TargetHumanoid:TakeDamage(TwitcherDamage)
- end
- Wait(0.21)
- TwitcherHumanoid.WalkSpeed = 30
- end
- function FindTarget()
- local ClosestCharacter
- local ClosestHumanoid = nil
- local ClosestTorso = nil
- local ClosestTorsoDistance = 99999e99999
- for TargetCount, TargetModel in pairs(Game.Workspace:GetChildren()) do
- if TargetModel:IsA("Model") and (TargetModel ~= Twitcher) and (TargetModel.Name ~= Twitcher.Name) and (TargetModel.Name ~= "Stranger") and (TargetModel.Name ~= "David Leatherhoff") and (TargetModel.Name ~= "HandCrab") and (TargetModel.Name ~= "GhostAbomination") then
- if TargetModel:FindFirstChild("Humanoid")~=nil then
- local humanoid = TargetModel:FindFirstChild("Humanoid")
- local torso = TargetModel:FindFirstChild("Torso")
- if torso ~= nil then
- local TorsoDistance = (torso.Position - Torso.Position).magnitude
- if humanoid and humanoid.Health > 0 and torso and TorsoDistance <= ClosestTorsoDistance then
- ClosestCharacter = TargetModel
- ClosestHumanoid = humanoid
- ClosestTorso = torso
- ClosestTorsoDistance = TorsoDistance
- end
- end
- end
- end
- end
- return ClosestCharacter, ClosestHumanoid, ClosestTorso
- end
- function FindTarget2()
- local ClosestCharacter
- local ClosestHumanoid = nil
- local ClosestTorso = nil
- local ClosestTorsoDistance = 5
- for TargetCount, TargetModel in pairs(Game.Workspace:GetChildren()) do
- if TargetModel:IsA("Model") and (TargetModel ~= Twitcher) and (TargetModel.Name ~= Twitcher.Name) and (TargetModel.Name ~= "Stranger") and (TargetModel.Name ~= "David Leatherhoff") and (TargetModel.Name ~= "HandCrab") and (TargetModel.Name ~= "GhostAbomination") then
- if TargetModel:FindFirstChild("Humanoid")~=nil then
- local humanoid = TargetModel:FindFirstChild("Humanoid")
- local torso = TargetModel:FindFirstChild("Torso")
- if torso ~= nil then
- local TorsoDistance = (torso.Position - Torso.Position).magnitude
- if humanoid and humanoid.Health > 0 and torso and TorsoDistance <= ClosestTorsoDistance then
- ClosestCharacter = TargetModel
- ClosestHumanoid = humanoid
- ClosestTorso = torso
- ClosestTorsoDistance = TorsoDistance
- end
- end
- end
- end
- end
- return ClosestCharacter, ClosestHumanoid, ClosestTorso
- end
- Wait(5)
- for DavidHealthCheck = 1,5 do
- TwitcherHumanoid.Health = TwitcherHumanoid.MaxHealth
- Wait(0)
- end
- HumanoidRootPart.Anchored = false
- SpawnForceField:Destroy()
- function HurtSound(HumanoidData)
- if TwitcherHumanoid.Health<0 or TwitcherHumanoid.Health==0 then return end
- TwitcherPainSounds[math.random(1,#TwitcherPainSounds)]:Play()
- TwitcherPainSounds[math.random(1,#TwitcherPainSounds)].Pitch = 1 + (math.random() * 0.07)
- end
- TwitcherHumanoid.HealthChanged:connect(HurtSound)
- while Wait(0) do
- if TwitcherHumanoid.Health == 0 or TwitcherHumanoid.Health < 0 then
- TwitcherHumanoid.WalkSpeed = 0
- script.Disabled = true
- Wait(5)
- Twitcher:Destroy()
- end
- if TwitcherHumanoid.Sit==true then
- TwitcherHumanoid.Jump=true
- end
- if TwitcherHumanoid.PlatformStand==true then
- TwitcherHumanoid.Jump=true
- end
- local character, humanoid, torso = FindTarget()
- if character and character.Parent and humanoid and humanoid.Parent and torso and torso.Parent then
- FollowTarget(humanoid, torso)
- end
- local character, humanoid, torso = FindTarget2()
- if character and character.Parent and humanoid and humanoid.Parent and torso and torso.Parent then
- ThunderAttack(humanoid, torso)
- end
- local TwitcherAlertSound = (math.random(1,500))
- if TwitcherAlertSound == 100 then
- TwitcherAlertSounds[math.random(1,#TwitcherAlertSounds)].Pitch = 1 + (math.random() * 0.07)
- TwitcherAlertSounds[math.random(1,#TwitcherAlertSounds)]:Play()
- end
- end
- --[[ By: Brutez ]]--
- end,o34)
- end))
- o35.Name = "Roblox 2.0 Left Arm"
- o35.Parent = o1
- o35.MeshId = 27111419
- o35.BodyPart = Enum.BodyPart.LeftArm
- o36.Name = "Roblox 2.0 Left Leg"
- o36.Parent = o1
- o36.MeshId = 27111857
- o36.BodyPart = Enum.BodyPart.LeftLeg
- o37.Name = "Roblox 2.0 Right Arm"
- o37.Parent = o1
- o37.MeshId = 27111864
- o37.BodyPart = Enum.BodyPart.RightArm
- o38.Name = "AnimateSauce"
- o38.Parent = o1
- table.insert(cors,coroutine.create(function()
- wait()
- runDummyScript(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 Humanoid;
- for _,Child in pairs(Figure:GetChildren())do
- if Child and Child.ClassName=="Humanoid"then
- Humanoid=Child;
- end;
- end;
- 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=180436148", 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 }
- },
- dance1 = {
- { 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 }
- },
- }
- local dances = {"dance1", "dance2", "dance3"}
- -- 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, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
- 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, Humanoid)
- setAnimationSpeed(animSpeed)
- end
- end
- -- Preload animations
- function playAnimation(animName, transitionTime, humanoid)
- 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 humanoid; get AnimationTrack
- currentAnimTrack = humanoid: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, Humanoid)
- end
- end
- function playToolAnimation(animName, transitionTime, humanoid)
- 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 humanoid; get AnimationTrack
- toolAnimTrack = humanoid: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, Humanoid)
- 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, Humanoid)
- pose = "Standing"
- end
- end
- function onDied()
- pose = "Dead"
- end
- function onJumping()
- playAnimation("jump", 0.1, Humanoid)
- jumpAnimTime = jumpAnimDuration
- pose = "Jumping"
- end
- function onClimbing(speed)
- playAnimation("climb", 0.1, Humanoid)
- setAnimationSpeed(speed / 12.0)
- pose = "Climbing"
- end
- function onGettingUp()
- pose = "GettingUp"
- end
- function onFreeFall()
- if (jumpAnimTime <= 0) then
- playAnimation("fall", fallTransitionTime, Humanoid)
- 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, Humanoid)
- return
- end
- if (toolAnim == "Slash") then
- playToolAnimation("toolslash", 0, Humanoid)
- return
- end
- if (toolAnim == "Lunge") then
- playToolAnimation("toollunge", 0, Humanoid)
- 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, Humanoid)
- elseif (pose == "Seated") then
- playAnimation("sit", 0.5, Humanoid)
- return
- elseif (pose == "Running") then
- playAnimation("walk", 0.1, Humanoid)
- 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
- local 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
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(onJumping)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.GettingUp:connect(onGettingUp)
- Humanoid.FreeFalling:connect(onFreeFall)
- Humanoid.FallingDown:connect(onFallingDown)
- Humanoid.Seated:connect(onSeated)
- Humanoid.PlatformStanding:connect(onPlatformStanding)
- Humanoid.Swimming:connect(onSwimming)
- local runService = game:service("RunService");
- -- initialize to idle
- playAnimation("idle", 0.1, Humanoid);
- pose = "Standing";
- while Wait(0)do
- move(0);
- end;
- end,o38)
- end))
- o39.Name = "climb"
- o39.Parent = o38
- o40.Name = "ClimbAnim"
- o40.Parent = o39
- o40.AnimationId = "http://www.roblox.com/asset/?id=180436334"
- o41.Name = "fall"
- o41.Parent = o38
- o42.Name = "FallAnim"
- o42.Parent = o41
- o42.AnimationId = "http://www.roblox.com/asset/?id=180436148"
- o43.Name = "idle"
- o43.Parent = o38
- o44.Name = "Animation1"
- o44.Parent = o43
- o44.AnimationId = "http://www.roblox.com/asset/?id=180435571"
- o45.Name = "Weight"
- o45.Parent = o44
- o45.Value = 9
- o46.Name = "Animation2"
- o46.Parent = o43
- o46.AnimationId = "http://www.roblox.com/asset/?id=180435792"
- o47.Name = "Weight"
- o47.Parent = o46
- o47.Value = 1
- o48.Name = "jump"
- o48.Parent = o38
- o49.Name = "JumpAnim"
- o49.Parent = o48
- o49.AnimationId = "http://www.roblox.com/asset/?id=125750702"
- o50.Name = "run"
- o50.Parent = o38
- o51.Name = "RunAnim"
- o51.Parent = o50
- o51.AnimationId = "http://www.roblox.com/asset/?id=180426354"
- o52.Name = "sit"
- o52.Parent = o38
- o53.Name = "SitAnim"
- o53.Parent = o52
- o53.AnimationId = "http://www.roblox.com/asset/?id=178130996"
- o54.Name = "toolnone"
- o54.Parent = o38
- o55.Name = "ToolNoneAnim"
- o55.Parent = o54
- o55.AnimationId = "http://www.roblox.com/asset/?id=182393478"
- o56.Name = "walk"
- o56.Parent = o38
- o57.Name = "WalkAnim"
- o57.Parent = o56
- o57.AnimationId = "http://www.roblox.com/asset/?id=180426354"
- o58.Parent = o1
- o58.HeadColor = BrickColor.new("Sand red")
- o58.LeftArmColor = BrickColor.new("Black")
- o58.LeftLegColor = BrickColor.new("Brick yellow")
- o58.RightArmColor = BrickColor.new("Black")
- o58.RightLegColor = BrickColor.new("Brick yellow")
- o58.TorsoColor = BrickColor.new("Black")
- mas.Parent = workspace
- mas:MakeJoints()
- local mas1 = mas:GetChildren()
- for i=1,#mas1 do
- mas1[i].Parent = script
- ypcall(function() mas1[i]:MakeJoints() end)
- end
- mas:Destroy()
- for i=1,#cors do
- coroutine.resume(cors[i])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement