Gystac

dog

Jan 4th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.31 KB | None | 0 0
  1. --Canine Companion by MUDDMUTT props = { {"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)}, {"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)}, {"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)}, {"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)}, {"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)}, {"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)}, {"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)}, {"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)}, {"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)}, {"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)}, {"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)} } owner = "luxulux" --Your name here if game.Workspace:findFirstChild(owner .. "'s Dog") then game.Workspace[owner .. "'s Dog"]:Destroy() end model = Instance.new("Model") model.Name = owner .. "'s Dog" for p = 1, #props do part = Instance.new(props[p][1], model) part.Anchored = true part.Locked = true if props[p][1] == "Part" then brick = {"Part", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "FormFactor", "Shape", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"} elseif props[p][1] == "WedgePart" then brick = {"WedgePart", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "FormFactor", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"} elseif props[p][1] == "CornerWedgePart" then brick = {"CornerWedgePart", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"} elseif props[p][1] == "TrussPart" then brick = {"TrussPart", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "Size", "Style", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"} elseif props[p][1] == "Seat" then brick = {"Seat", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "Disabled", "FormFactor", "Shape", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"} elseif props[p][1] == "VehicleSeat" then brick = {"VehicleSeat", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "Disabled", "HeadsUpDisplay", "MaxSpeed", "Torque", "TurnSpeed", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"} elseif props[p][1] == "SkatboardPlatform" then brick = {"SkateboardPatform", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "StickyWheels", "FormFactor", "Shape", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"} elseif props[p][1] == "SpawnLocation" then brick = {"SpawnLocation", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "AllowTeamChangeOnTouch", "Neutral", "TeamColor", "Duration", "FormFactor", "Shape", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"} elseif props[p][1] == "FlagStand" then brick = {"FlagStand", "Name", "BrickColor", "Material", "Reflectance", "Transparency", "CanCollide", "TeamColor", "FormFactor", "Shape", "Size", "BackSurface", "BottomSurface", "FrontSurface", "LeftSurface", "RightSurface", "TopSurface", "CFrame"} end for b = 2, #props[p] do prop = props[p][b] proptype = type(prop) if proptype ~= "table" then part[brick[b]] = prop else equip = Instance.new(props[p][b][1], part) if props[p][b][1] == "Decal" then brickequip = {"Decal", "Name", "Shiny", "Specular", "Texture", "Transparency", "Face"} elseif props[p][b][1] == "Texture" then brickequip = {"Texture", "Name", "Shiny", "Specular", "StudsPerTileU", "StudsPerTileV", "Texture", "Transparency", "Face"} elseif props[p][b][1] == "Fire" then brickequip = {"Fire", "Name", "Color", "Enabled", "Heat", "SecondaryColor", "Size"} elseif props[p][b][1] == "Smoke" then brickequip = {"Smoke", "Name", "Color", "Enabled", "Opacity", "RiseVelocity", "Size"} elseif props[p][b][1] == "Sparkles" then brickequip = {"Sparkles", "Name", "Enabled", "SparkleColor"} elseif props[p][b][1] == "BlockMesh" then brickequip = {"BlockMesh", "Name", "Offset", "Scale", "VertexColor"} elseif props[p][b][1] == "CylinderMesh" then brickequip = {"CylinderMesh", "Name", "Offset", "Scale", "VertexColor"} elseif props[p][b][1] == "SpecialMesh" then brickequip = {"SpecialMesh", "Name", "MeshId", "MeshType", "Offset", "Scale", "TextureId", "VertexColor"} end for e = 2, #brickequip do equip[brickequip[e]] = props[p][b][e] end end end end function makeJoint(x, y, C0, C1) joint = Instance.new("Motor") joint.Part0 = x joint.Part1 = y local HitPos = x.Position joint.Parent = x joint.C0 = C0 joint.C1 = C1 return joint end function makeWeld(x, y) weld = Instance.new("Motor") weld.Part0 = x weld.Part1 = y local HitPos = x.Position local CJ = CFrame.new(HitPos) local C0 = x.CFrame:inverse() * CJ local C1 = y.CFrame:inverse() * CJ weld.C0 = C0 weld.C1 = C1 weld.Parent = x return joint end 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)) LeftHip.MaxVelocity = 1 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)) RightHip.MaxVelocity = 1 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)) LeftShoulder.MaxVelocity = 0.15 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)) RightShoulder.MaxVelocity = 0.15 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)) 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)) makeWeld(model.FakeHead, model.Head) makeWeld(model.FakeHead, model.Nose) makeWeld(model.FakeHead, model["Left Ear"]) makeWeld(model.FakeHead, model["Right Ear"]) balance = Instance.new("BodyGyro", model.Torso) balance.maxTorque = Vector3.new(math.huge, 0, math.huge) parts = model:GetChildren() for p = 1, #parts do parts[p].Anchored = false end Humanoid = Instance.new("Humanoid", model) model.Parent = game.Workspace function waitForChild(parent, childName) local child = parent:findFirstChild(childName) if child then return child end while true do child = parent.ChildAdded:wait() if child.Name==childName then return child end end end -- ANIMATION -- declarations local Figure = model local pose = "Standing" local toolAnim = "None" local toolAnimTime = 0 -- functions function onRunning(speed) if speed>0 then pose = "Running" else pose = "Standing" end end function onDied() pose = "Dead" wait(3) Figure:Destroy() end function onJumping() pose = "Jumping" end function onClimbing() pose = "Climbing" end function onGettingUp() pose = "GettingUp" end function onFreeFall() pose = "FreeFall" end function onFallingDown() pose = "FallingDown" end function onSeated() pose = "Seated" end function onPlatformStanding() pose = "PlatformStanding" end function onSwimming(speed) if speed>0 then pose = "Running" else pose = "Standing" end end function moveJump() RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 0.735 LeftShoulder.DesiredAngle = 0.735 RightHip.DesiredAngle = -0.735 LeftHip.DesiredAngle = -0.735 end -- same as jump for now function moveFreeFall() RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 0.735 LeftShoulder.DesiredAngle = 0.735 RightHip.DesiredAngle = -0.735 LeftHip.DesiredAngle = -0.735 end function moveSit() RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 RightShoulder.DesiredAngle = 3.14 /2 LeftShoulder.DesiredAngle = 3.14 /2 RightHip.DesiredAngle = 3.14 /2 LeftHip.DesiredAngle = 3.14 /2 end function getTool() for _, kid in ipairs(Figure:GetChildren()) do if kid.className == "Tool" then return kid end end return nil end function getToolAnim(tool) for _, c in ipairs(tool:GetChildren()) do if c.Name == "toolanim" and c.className == "StringValue" then return c end end return nil end function animateTool() if (toolAnim == "None") then RightShoulder.DesiredAngle = 1.57 return end if (toolAnim == "Slash") then RightShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 0 return end if (toolAnim == "Lunge") then RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 1.57 LeftShoulder.DesiredAngle = 1.0 RightHip.DesiredAngle = 1.57 LeftHip.DesiredAngle = 1.0 return end end function move(time) local amplitude local frequency if (pose == "Jumping") then moveJump() return end if (pose == "FreeFall") then moveFreeFall() return end if (pose == "Seated") then moveSit() return end local climbFudge = 0 if (pose == "Running") then RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 amplitude = 1 frequency = 9 elseif (pose == "Climbing") then RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 amplitude = 1 frequency = 9 climbFudge = 0 else amplitude = 0.1 frequency = 1 end desiredAngle = amplitude * math.sin(time*frequency) RightShoulder.DesiredAngle = desiredAngle + climbFudge LeftShoulder.DesiredAngle = desiredAngle - climbFudge RightHip.DesiredAngle = -desiredAngle LeftHip.DesiredAngle = -desiredAngle local tool = getTool() if tool then animStringValueObject = getToolAnim(tool) if animStringValueObject then toolAnim = animStringValueObject.Value -- message recieved, delete StringValue animStringValueObject.Parent = nil toolAnimTime = time + .3 end if time > toolAnimTime then toolAnimTime = 0 toolAnim = "None" end animateTool() else toolAnim = "None" toolAnimTime = 0 end end -- connect events Humanoid.Died:connect(onDied) Humanoid.Running:connect(onRunning) Humanoid.Jumping:connect(onJumping) Humanoid.Climbing:connect(onClimbing) Humanoid.GettingUp:connect(onGettingUp) Humanoid.FreeFalling:connect(onFreeFall) Humanoid.FallingDown:connect(onFallingDown) Humanoid.Seated:connect(onSeated) Humanoid.PlatformStanding:connect(onPlatformStanding) Humanoid.Swimming:connect(onSwimming) -- main program local runService = game:service("RunService"); if game.Players:findFirstChild(owner) then player = game.Players:findFirstChild(owner) end player.Chatted:connect(function(chat) if string.lower(chat) == "sit" then Humanoid.Sit = true elseif string.lower(chat) == "come" then Humanoid.Sit = false elseif string.lower(string.sub(chat, 1, 6)) == "attack" then victims = {} if string.find(chat, ",") then list = string.lower(string.sub(chat, 8)) if list then for name in string.gmatch(list, ",") do players = game.Players:GetPlayers() for p = 1, #players do added = false if string.find(string.lower(players[p].Name), name) then for v = 1, #victims do if victims[v] == players[p] then added = true end end if not added then table.insert(victims, players[p]) end end end end end else name = string.lower(string.sub(chat, 8)) if name then players = game.Players:GetPlayers() for p = 1, #players do if string.find(string.lower(players[p].Name), name) then table.insert(victims, players[p]) end end end end if #victims > 0 then attack(1) end end end) function attack(v) victim = victims[v].Character model.Nose.Touched:connect(function(part) if part.Parent == victim then victim.Humanoid.Health = 0 v = v + 1 if v <= #victims then attack(v) else victims = {} victim = nil end end end) end while Figure.Parent~=nil do if player then if player.Character and not victim then Humanoid:MoveTo(player.Character:GetModelCFrame().p, player.Character.HumanoidRootPart) else if victim then Humanoid:MoveTo(victim:GetModelCFrame().p, victim.HumanoidRootPart) end end end local _, time = wait(0.1) move(time) end
Add Comment
Please, Sign In to add comment