SHOW:
|
|
- or go back to the newest paste.
| 1 | --Lenny | |
| 2 | local player = game.Players.LocalPlayer | |
| 3 | props = {
| |
| 4 | {"Part", "FakeHead", BrickColor.new("Dark orange"), Enum.Material.Plastic, 0, 0, true, Enum.FormFactor.Custom, Enum.PartType.Block, Vector3.new(0.600000024, 0.600000024, 0.600000024), Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, CFrame.new(0.100388065, 18.1003742, 23.299799, -0.999996185, -8.13055522e-007, 5.31445039e-007, -5.31440719e-007, 1.87754631e-006, 1.00000095, 8.12811663e-007, 0.999996245, 1.84774399e-006)},
| |
| 5 | {"Part", "Head", BrickColor.new("Dark orange"), Enum.Material.Plastic, 0, 0, true, Enum.FormFactor.Custom, Enum.PartType.Block, Vector3.new(0.600000024, 0.800000012, 0.600000143), Enum.SurfaceType.Smooth, Enum.SurfaceType.Inlet, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, CFrame.new(0.100388199, 17.9003735, 22.9997997, 9.81613994e-007, -1.6822014e-007, 0.999996185, 0.707106173, 0.707108796, 4.87729267e-007, -0.707102835, 0.707105458, -8.12811777e-007)},
| |
| 6 | {"Part", "Left Arm", BrickColor.new("Dark orange"), Enum.Material.Plastic, 0, 0, false, Enum.FormFactor.Custom, Enum.PartType.Block, Vector3.new(0.400000006, 1.20000005, 0.400000006), Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Studs, CFrame.new(0.400146782, 16.7069683, 22.8387585, 0.00159182027, 5.33444677e-007, -0.999994934, -0.0503749102, 0.998731315, -8.07183023e-005, 0.998725235, 0.0503784381, 0.0015914517)},
| |
| 7 | {"Part", "Left Leg", BrickColor.new("Dark orange"), Enum.Material.Plastic, 0, 0, false, Enum.FormFactor.Custom, Enum.PartType.Block, Vector3.new(0.400000006, 1.20000005, 0.400000006), Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Studs, CFrame.new(0.395848215, 16.7976437, 21.0410557, 0.00159182027, 5.33444677e-007, -0.999994934, -0.0503749102, 0.998731315, -8.07183023e-005, 0.998725235, 0.0503784381, 0.0015914517)},
| |
| 8 | {"Part", "Nose", BrickColor.new("Dark orange"), Enum.Material.Plastic, 0, 0, true, Enum.FormFactor.Custom, Enum.PartType.Block, Vector3.new(0.400000006, 0.400000006, 0.400000006), Enum.SurfaceType.Smooth, Enum.SurfaceType.Inlet, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, CFrame.new(0.100409508, 18.0003757, 23.7997837, -0.999996185, -8.13055408e-007, 5.31443845e-007, -5.31442083e-007, 2.05634728e-006, 1.00000095, 8.12811663e-007, 0.999996245, 1.66894381e-006)},
| |
| 9 | {"Part", "Right Arm", BrickColor.new("Dark orange"), Enum.Material.Plastic, 0, 0, false, Enum.FormFactor.Custom, Enum.PartType.Block, Vector3.new(0.400000006, 1.20000005, 0.400000006), Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Studs, CFrame.new(-0.199849263, 16.7068958, 22.8401909, 0.00159182027, 5.33444677e-007, -0.999994934, -0.0503749102, 0.998731315, -8.07183023e-005, 0.998725235, 0.0503784381, 0.0015914517)},
| |
| 10 | {"Part", "Right Leg", BrickColor.new("Dark orange"), Enum.Material.Plastic, 0, 0, false, Enum.FormFactor.Custom, Enum.PartType.Block, Vector3.new(0.400000006, 1.20000005, 0.400000006), Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Studs, CFrame.new(-0.204147831, 16.7975712, 21.0424881, 0.00159182027, 5.33444677e-007, -0.999994934, -0.0503749102, 0.998731315, -8.07183023e-005, 0.998725235, 0.0503784381, 0.0015914517)},
| |
| 11 | {"Part", "Tail", BrickColor.new("Dark orange"), Enum.Material.Plastic, 0, 0, false, Enum.FormFactor.Custom, Enum.PartType.Block, Vector3.new(0.200000003, 1.20000005, 0.200000003), Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, CFrame.new(0.0946565717, 17.6217804, 20.5827122, 9.81613994e-007, -1.6822014e-007, 0.999996185, 0.707106173, 0.707108796, 4.87729267e-007, -0.707102835, 0.707105458, -8.12811777e-007)},
| |
| 12 | {"Part", "Torso", BrickColor.new("Dark orange"), Enum.Material.Plastic, 0, 0, true, Enum.FormFactor.Custom, Enum.PartType.Block, Vector3.new(1, 0.800000012, 2.20000029), Enum.SurfaceType.Smooth, Enum.SurfaceType.Inlet, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Studs, CFrame.new(0.0980000049, 17.7510014, 21.9910011, -0.999993324, 5.33444677e-007, -0.0023880899, -0.000120830518, 0.998731315, 0.0503748283, 0.00238671037, 0.0503784381, -0.998723626)},
| |
| 13 | {"WedgePart", "Left Ear", BrickColor.new("Dark orange"), Enum.Material.Plastic, 0, 0, true, Enum.FormFactor.Custom, Vector3.new(0.200000003, 0.600000024, 0.200000003), Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, CFrame.new(0.500348866, 18.090374, 23.1997814, -7.77199602e-007, 5.32613967e-007, -0.999996185, 8.9403602e-007, 1.00000095, -5.30270995e-007, 0.999996245, 2.83124973e-006, 8.48668094e-007)},
| |
| 14 | {"WedgePart", "Right Ear", BrickColor.new("Dark orange"), Enum.Material.Plastic, 0, 0, true, Enum.FormFactor.Custom, Vector3.new(0.200000003, 0.600000024, 0.200000003), Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth, CFrame.new(-0.299625933, 18.090374, 23.1997833, 7.77199602e-007, 5.326105e-007, 0.999996185, -8.04604042e-007, 1.00000095, 5.30274406e-007, -0.999996245, 2.92068125e-006, -8.48668151e-007)}
| |
| 15 | } | |
| 16 | ||
| 17 | owner = "Lenny" --vanessalavafox22 | |
| 18 | ||
| 19 | if game.Workspace:findFirstChild(owner .. "'s Dog") then | |
| 20 | game.Workspace[owner .. "'s Dog"]:Destroy() | |
| 21 | end | |
| 22 | ||
| 23 | model = Instance.new("Model")
| |
| 24 | model.Name = owner .. "'s Dog" | |
| 25 | ||
| 26 | for p = 1, #props do | |
| 27 | part = Instance.new(props[p][1], model) | |
| 28 | part.Anchored = true | |
| 29 | part.Locked = true | |
| 30 | if props[p][1] == "Part" then | |
| 31 | brick = {"Part", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "FormFactor", "Shape", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"}
| |
| 32 | elseif props[p][1] == "WedgePart" then | |
| 33 | brick = {"WedgePart", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "FormFactor", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"}
| |
| 34 | elseif props[p][1] == "CornerWedgePart" then | |
| 35 | brick = {"CornerWedgePart", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"}
| |
| 36 | elseif props[p][1] == "TrussPart" then | |
| 37 | brick = {"TrussPart", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "Size", "Style", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"}
| |
| 38 | elseif props[p][1] == "Seat" then | |
| 39 | brick = {"Seat", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "Disabled", "FormFactor", "Shape", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"}
| |
| 40 | elseif props[p][1] == "VehicleSeat" then | |
| 41 | brick = {"VehicleSeat", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "Disabled", "HeadsUpDisplay", "MaxSpeed", "Torque", "TurnSpeed", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"}
| |
| 42 | elseif props[p][1] == "SkatboardPlatform" then | |
| 43 | brick = {"SkateboardPatform", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "StickyWheels", "FormFactor", "Shape", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"}
| |
| 44 | elseif props[p][1] == "SpawnLocation" then | |
| 45 | brick = {"SpawnLocation", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "AllowTeamChangeOnTouch", "Neutral", "TeamColor", "Duration", "FormFactor", "Shape", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"}
| |
| 46 | elseif props[p][1] == "FlagStand" then | |
| 47 | brick = {"FlagStand", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "TeamColor", "FormFactor", "Shape", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"}
| |
| 48 | end | |
| 49 | for b = 2, #props[p] do | |
| 50 | prop = props[p][b] | |
| 51 | proptype = type(prop) | |
| 52 | if proptype ~= "table" then | |
| 53 | part[brick[b]] = prop | |
| 54 | else | |
| 55 | equip = Instance.new(props[p][b][1], part) | |
| 56 | if props[p][b][1] == "Decal" then | |
| 57 | brickequip = {"Decal", "Name", "Shiny", "Specular", "Texture", "Transparency", "Face"}
| |
| 58 | elseif props[p][b][1] == "Texture" then | |
| 59 | brickequip = {"Texture", "Name", "Shiny", "Specular", "StudsPerTileU", "StudsPerTileV", "Texture", "Transparency", "Face"}
| |
| 60 | elseif props[p][b][1] == "Fire" then | |
| 61 | brickequip = {"Fire", "Name", "Color", "Enabled", "Heat", "SecondaryColor", "Size"}
| |
| 62 | elseif props[p][b][1] == "Smoke" then | |
| 63 | brickequip = {"Smoke", "Name", "Color", "Enabled", "Opacity", "RiseVelocity", "Size"}
| |
| 64 | elseif props[p][b][1] == "Sparkles" then | |
| 65 | brickequip = {"Sparkles", "Name", "Enabled", "SparkleColor"}
| |
| 66 | elseif props[p][b][1] == "BlockMesh" then | |
| 67 | brickequip = {"BlockMesh", "Name", "Offset", "Scale", "VertexColor"}
| |
| 68 | elseif props[p][b][1] == "CylinderMesh" then | |
| 69 | brickequip = {"CylinderMesh", "Name", "Offset", "Scale", "VertexColor"}
| |
| 70 | elseif props[p][b][1] == "SpecialMesh" then | |
| 71 | brickequip = {"SpecialMesh", "Name", "MeshId", "MeshType", "Offset", "Scale", "TextureId", "VertexColor"}
| |
| 72 | end | |
| 73 | for e = 2, #brickequip do | |
| 74 | equip[brickequip[e]] = props[p][b][e] | |
| 75 | end | |
| 76 | end | |
| 77 | end | |
| 78 | end | |
| 79 | ||
| 80 | function makeJoint(x, y, C0, C1) | |
| 81 | joint = Instance.new("Motor")
| |
| 82 | joint.Part0 = x | |
| 83 | joint.Part1 = y | |
| 84 | local HitPos = x.Position | |
| 85 | joint.Parent = x | |
| 86 | joint.C0 = C0 | |
| 87 | joint.C1 = C1 | |
| 88 | return joint | |
| 89 | end | |
| 90 | ||
| 91 | function makeWeld(x, y) | |
| 92 | weld = Instance.new("Motor")
| |
| 93 | weld.Part0 = x | |
| 94 | weld.Part1 = y | |
| 95 | local HitPos = x.Position | |
| 96 | local CJ = CFrame.new(HitPos) | |
| 97 | local C0 = x.CFrame:inverse() * CJ | |
| 98 | local C1 = y.CFrame:inverse() * CJ | |
| 99 | weld.C0 = C0 | |
| 100 | weld.C1 = C1 | |
| 101 | weld.Parent = x | |
| 102 | return joint | |
| 103 | end | |
| 104 | ||
| 105 | LeftHip = makeJoint(model.Torso, model["Left Leg"], CFrame.new(-0.300000012, 0, 0.899999976, 0.000796274282, 0, 0.999999702, 0, 1, 0, -0.999999702, 0, 0.000796274282), CFrame.new(0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)) | |
| 106 | LeftHip.MaxVelocity = 1 | |
| 107 | RightHip = makeJoint(model.Torso, model["Right Leg"], CFrame.new(0.300000012, 0, 0.899999917, 0.000796274282, 0, 0.999999702, 0, 1, 0, -0.999999702, 0, 0.000796274282), CFrame.new(0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)) | |
| 108 | RightHip.MaxVelocity = 1 | |
| 109 | LeftShoulder = makeJoint(model.Torso, model["Left Arm"], CFrame.new(-0.300000012, -2.23517418e-008, -0.900000036, 0.000796274282, 0, 0.999999702, 0, 1, 0, -0.999999702, 0, 0.000796274282), CFrame.new(0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)) | |
| 110 | LeftShoulder.MaxVelocity = 0.15 | |
| 111 | RightShoulder = makeJoint(model.Torso, model["Right Arm"], CFrame.new(0.300000012, -1.49011612e-008, -0.900000036, 0.000796274282, 0, 0.999999702, 0, 1, 0, -0.999999702, 0, 0.000796274282), CFrame.new(0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)) | |
| 112 | RightShoulder.MaxVelocity = 0.15 | |
| 113 | Neck = makeJoint(model.Torso, model.Head, CFrame.new(0, 0.200000018, -1, -0.00177218916, 0.00160199252, -0.999997139, 0.670587182, 0.741830766, 0, 0.74182862, -0.670585275, -0.00238893996), CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)) | |
| 114 | TailJoint = makeJoint(model.Torso, model.Tail, CFrame.new(0, -0.199999988, 1.39999998, -0.00177218916, 0.00160199252, -0.999997139, 0.670587182, 0.741830766, 0, 0.74182862, -0.670585275, -0.00238893996), CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)) | |
| 115 | ||
| 116 | makeWeld(model.FakeHead, model.Head) | |
| 117 | makeWeld(model.FakeHead, model.Nose) | |
| 118 | makeWeld(model.FakeHead, model["Left Ear"]) | |
| 119 | makeWeld(model.FakeHead, model["Right Ear"]) | |
| 120 | ||
| 121 | balance = Instance.new("BodyGyro", model.Torso)
| |
| 122 | balance.maxTorque = Vector3.new(math.huge, 0, math.huge) | |
| 123 | ||
| 124 | parts = model:GetChildren() | |
| 125 | for p = 1, #parts do | |
| 126 | parts[p].Anchored = false | |
| 127 | end | |
| 128 | ||
| 129 | Humanoid = Instance.new("Humanoid", model)
| |
| 130 | ||
| 131 | model.Parent = game.Workspace | |
| 132 | ||
| 133 | function waitForChild(parent, childName) | |
| 134 | local child = parent:findFirstChild(childName) | |
| 135 | if child then return child end | |
| 136 | while true do | |
| 137 | child = parent.ChildAdded:wait() | |
| 138 | if child.Name==childName then return child end | |
| 139 | end | |
| 140 | end | |
| 141 | ||
| 142 | -- ANIMATION | |
| 143 | ||
| 144 | -- declarations | |
| 145 | ||
| 146 | local Figure = model | |
| 147 | local pose = "Standing" | |
| 148 | ||
| 149 | local toolAnim = "None" | |
| 150 | local toolAnimTime = 0 | |
| 151 | ||
| 152 | -- functions | |
| 153 | ||
| 154 | function onRunning(speed) | |
| 155 | if speed>0 then | |
| 156 | pose = "Running" | |
| 157 | else | |
| 158 | pose = "Standing" | |
| 159 | end | |
| 160 | end | |
| 161 | ||
| 162 | function onDied() | |
| 163 | pose = "Dead" | |
| 164 | wait(3) | |
| 165 | Figure:Destroy() | |
| 166 | end | |
| 167 | ||
| 168 | function onJumping() | |
| 169 | pose = "Jumping" | |
| 170 | end | |
| 171 | ||
| 172 | function onClimbing() | |
| 173 | pose = "Climbing" | |
| 174 | end | |
| 175 | ||
| 176 | function onGettingUp() | |
| 177 | pose = "GettingUp" | |
| 178 | end | |
| 179 | ||
| 180 | function onFreeFall() | |
| 181 | pose = "FreeFall" | |
| 182 | end | |
| 183 | ||
| 184 | function onFallingDown() | |
| 185 | pose = "FallingDown" | |
| 186 | end | |
| 187 | ||
| 188 | function onSeated() | |
| 189 | pose = "Seated" | |
| 190 | end | |
| 191 | ||
| 192 | function onPlatformStanding() | |
| 193 | pose = "PlatformStanding" | |
| 194 | end | |
| 195 | ||
| 196 | function onSwimming(speed) | |
| 197 | if speed>0 then | |
| 198 | pose = "Running" | |
| 199 | else | |
| 200 | pose = "Standing" | |
| 201 | end | |
| 202 | end | |
| 203 | ||
| 204 | function moveJump() | |
| 205 | RightShoulder.MaxVelocity = 0.5 | |
| 206 | LeftShoulder.MaxVelocity = 0.5 | |
| 207 | RightShoulder.DesiredAngle = 0.735 | |
| 208 | LeftShoulder.DesiredAngle = 0.735 | |
| 209 | RightHip.DesiredAngle = -0.735 | |
| 210 | LeftHip.DesiredAngle = -0.735 | |
| 211 | end | |
| 212 | ||
| 213 | ||
| 214 | -- same as jump for now | |
| 215 | ||
| 216 | function moveFreeFall() | |
| 217 | RightShoulder.MaxVelocity = 0.5 | |
| 218 | LeftShoulder.MaxVelocity = 0.5 | |
| 219 | RightShoulder.DesiredAngle = 0.735 | |
| 220 | LeftShoulder.DesiredAngle = 0.735 | |
| 221 | RightHip.DesiredAngle = -0.735 | |
| 222 | LeftHip.DesiredAngle = -0.735 | |
| 223 | end | |
| 224 | ||
| 225 | function moveSit() | |
| 226 | RightShoulder.MaxVelocity = 0.15 | |
| 227 | LeftShoulder.MaxVelocity = 0.15 | |
| 228 | RightShoulder.DesiredAngle = 3.14 /2 | |
| 229 | LeftShoulder.DesiredAngle = 3.14 /2 | |
| 230 | RightHip.DesiredAngle = 3.14 /2 | |
| 231 | LeftHip.DesiredAngle = 3.14 /2 | |
| 232 | end | |
| 233 | ||
| 234 | function getTool() | |
| 235 | for _, kid in ipairs(Figure:GetChildren()) do | |
| 236 | if kid.className == "Tool" then return kid end | |
| 237 | end | |
| 238 | return nil | |
| 239 | end | |
| 240 | ||
| 241 | function getToolAnim(tool) | |
| 242 | for _, c in ipairs(tool:GetChildren()) do | |
| 243 | if c.Name == "toolanim" and c.className == "StringValue" then | |
| 244 | return c | |
| 245 | end | |
| 246 | end | |
| 247 | return nil | |
| 248 | end | |
| 249 | ||
| 250 | function animateTool() | |
| 251 | ||
| 252 | if (toolAnim == "None") then | |
| 253 | RightShoulder.DesiredAngle = 1.57 | |
| 254 | return | |
| 255 | end | |
| 256 | ||
| 257 | if (toolAnim == "Slash") then | |
| 258 | RightShoulder.MaxVelocity = 0.5 | |
| 259 | RightShoulder.DesiredAngle = 0 | |
| 260 | return | |
| 261 | end | |
| 262 | ||
| 263 | if (toolAnim == "Lunge") then | |
| 264 | RightShoulder.MaxVelocity = 0.5 | |
| 265 | LeftShoulder.MaxVelocity = 0.5 | |
| 266 | RightShoulder.DesiredAngle = 1.57 | |
| 267 | LeftShoulder.DesiredAngle = 1.0 | |
| 268 | RightHip.DesiredAngle = 1.57 | |
| 269 | LeftHip.DesiredAngle = 1.0 | |
| 270 | return | |
| 271 | end | |
| 272 | end | |
| 273 | ||
| 274 | function move(time) | |
| 275 | local amplitude | |
| 276 | local frequency | |
| 277 | ||
| 278 | if (pose == "Jumping") then | |
| 279 | moveJump() | |
| 280 | return | |
| 281 | end | |
| 282 | ||
| 283 | if (pose == "FreeFall") then | |
| 284 | moveFreeFall() | |
| 285 | return | |
| 286 | end | |
| 287 | ||
| 288 | if (pose == "Seated") then | |
| 289 | moveSit() | |
| 290 | return | |
| 291 | end | |
| 292 | ||
| 293 | local climbFudge = 0 | |
| 294 | ||
| 295 | if (pose == "Running") then | |
| 296 | RightShoulder.MaxVelocity = 0.15 | |
| 297 | LeftShoulder.MaxVelocity = 0.15 | |
| 298 | amplitude = 1 | |
| 299 | frequency = 9 | |
| 300 | elseif (pose == "Climbing") then | |
| 301 | RightShoulder.MaxVelocity = 0.5 | |
| 302 | LeftShoulder.MaxVelocity = 0.5 | |
| 303 | amplitude = 1 | |
| 304 | frequency = 9 | |
| 305 | climbFudge = 0 | |
| 306 | else | |
| 307 | amplitude = 0.1 | |
| 308 | frequency = 1 | |
| 309 | end | |
| 310 | ||
| 311 | desiredAngle = amplitude * math.sin(time*frequency) | |
| 312 | ||
| 313 | RightShoulder.DesiredAngle = desiredAngle + climbFudge | |
| 314 | LeftShoulder.DesiredAngle = desiredAngle - climbFudge | |
| 315 | RightHip.DesiredAngle = -desiredAngle | |
| 316 | LeftHip.DesiredAngle = -desiredAngle | |
| 317 | ||
| 318 | ||
| 319 | local tool = getTool() | |
| 320 | ||
| 321 | if tool then | |
| 322 | ||
| 323 | animStringValueObject = getToolAnim(tool) | |
| 324 | ||
| 325 | if animStringValueObject then | |
| 326 | toolAnim = animStringValueObject.Value | |
| 327 | -- message recieved, delete StringValue | |
| 328 | animStringValueObject.Parent = nil | |
| 329 | toolAnimTime = time + .3 | |
| 330 | end | |
| 331 | ||
| 332 | if time > toolAnimTime then | |
| 333 | toolAnimTime = 0 | |
| 334 | toolAnim = "None" | |
| 335 | end | |
| 336 | ||
| 337 | animateTool() | |
| 338 | ||
| 339 | ||
| 340 | else | |
| 341 | toolAnim = "None" | |
| 342 | toolAnimTime = 0 | |
| 343 | end | |
| 344 | end | |
| 345 | ||
| 346 | ||
| 347 | -- connect events | |
| 348 | ||
| 349 | Humanoid.Died:connect(onDied) | |
| 350 | Humanoid.Running:connect(onRunning) | |
| 351 | Humanoid.Jumping:connect(onJumping) | |
| 352 | Humanoid.Climbing:connect(onClimbing) | |
| 353 | Humanoid.GettingUp:connect(onGettingUp) | |
| 354 | Humanoid.FreeFalling:connect(onFreeFall) | |
| 355 | Humanoid.FallingDown:connect(onFallingDown) | |
| 356 | Humanoid.Seated:connect(onSeated) | |
| 357 | Humanoid.PlatformStanding:connect(onPlatformStanding) | |
| 358 | Humanoid.Swimming:connect(onSwimming) | |
| 359 | -- main program | |
| 360 | ||
| 361 | local runService = game:service("RunService");
| |
| 362 | ||
| 363 | if game.Players:findFirstChild(owner) then | |
| 364 | player = game.Players:findFirstChild(owner) | |
| 365 | end | |
| 366 | ||
| 367 | player.Chatted:connect(function(chat) | |
| 368 | if string.lower(chat) == "sit" then | |
| 369 | Humanoid.Sit = true | |
| 370 | elseif string.lower(chat) == "come" then | |
| 371 | Humanoid.Sit = false | |
| 372 | elseif string.lower(string.sub(chat, 1, 6)) == "attack" then | |
| 373 | victims = {}
| |
| 374 | if string.find(chat, ",") then | |
| 375 | list = string.lower(string.sub(chat, 8)) | |
| 376 | if list then | |
| 377 | for name in string.gmatch(list, ",") do | |
| 378 | players = game.Players:GetPlayers() | |
| 379 | for p = 1, #players do | |
| 380 | added = false | |
| 381 | if string.find(string.lower(players[p].Name), name) then | |
| 382 | for v = 1, #victims do | |
| 383 | if victims[v] == players[p] then | |
| 384 | added = true | |
| 385 | end | |
| 386 | end | |
| 387 | if not added then | |
| 388 | table.insert(victims, players[p]) | |
| 389 | end | |
| 390 | end | |
| 391 | end | |
| 392 | end | |
| 393 | end | |
| 394 | else | |
| 395 | name = string.lower(string.sub(chat, 8)) | |
| 396 | if name then | |
| 397 | players = game.Players:GetPlayers() | |
| 398 | for p = 1, #players do | |
| 399 | if string.find(string.lower(players[p].Name), name) then | |
| 400 | table.insert(victims, players[p]) | |
| 401 | end | |
| 402 | end | |
| 403 | end | |
| 404 | end | |
| 405 | if #victims > 0 then | |
| 406 | attack(1) | |
| 407 | end | |
| 408 | end | |
| 409 | end) | |
| 410 | ||
| 411 | function attack(v) | |
| 412 | victim = victims[v].Character | |
| 413 | model.Nose.Touched:connect(function(part) | |
| 414 | if part.Parent == victim then | |
| 415 | victim.Humanoid.Health = 0 | |
| 416 | v = v + 1 | |
| 417 | if v <= #victims then | |
| 418 | attack(v) | |
| 419 | else | |
| 420 | victims = {}
| |
| 421 | victim = nil | |
| 422 | end | |
| 423 | end | |
| 424 | end) | |
| 425 | end | |
| 426 | ||
| 427 | while Figure.Parent~=nil do | |
| 428 | if player then | |
| 429 | if player.Character and not victim then | |
| 430 | Humanoid:MoveTo(player.Character:GetModelCFrame().p, player.Character.HumanoidRootPart) | |
| 431 | else | |
| 432 | if victim then | |
| 433 | Humanoid:MoveTo(victim:GetModelCFrame().p, victim.HumanoidRootPart) | |
| 434 | end | |
| 435 | end | |
| 436 | end | |
| 437 | local _, time = wait(0.1) | |
| 438 | move(time) | |
| 439 | end |