Advertisement
Prephy

Dummy god

Apr 4th, 2021 (edited)
853
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.68 KB | None | 0 0
  1. wait()
  2. player = owner
  3. oldpos = nil
  4. name = nil
  5. local partmat = {"Part","FlagStand","Part"}
  6.  
  7.  
  8. function all()
  9.  
  10.     NLS([[
  11. function waitForChild(parent, childName)
  12.     while true do
  13.         local child = parent:findFirstChild(childName)
  14.         if child then
  15.             return child
  16.         end
  17.         parent.ChildAdded:wait()
  18.     end
  19. end
  20.  
  21. -- declarations
  22.  
  23. local Figure = game.Players.LocalPlayer.Character
  24. local Torso = waitForChild(Figure, "HumanoidRootPart")
  25. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  26. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  27. local RightHip = waitForChild(Torso, "Right Hip")
  28. local LeftHip = waitForChild(Torso, "Left Hip")
  29. local Neck = waitForChild(Torso, "Neck")
  30. local Humanoid =  Instance.new("Humanoid",Figure) Humanoid.BreakJointsOnDeath=false Humanoid.RequiresNeck=false Humanoid.MaxHealth=-300 Humanoid.Health=-300 --waitForChild(Figure, "Humanoid")
  31. workspace.CurrentCamera.CameraSubject=Humanoid
  32. Torso.CanCollide=false
  33. local arml = Instance.new("CharacterMesh",Figure) arml.MeshId="1112256772" arml.BodyPart=Enum.BodyPart.LeftArm
  34.     local armr = Instance.new("CharacterMesh",Figure) armr.MeshId="1112244824" armr.BodyPart=Enum.BodyPart.RightArm
  35.     local rightl = Instance.new("CharacterMesh",Figure) rightl.MeshId="1112267576" rightl.BodyPart=Enum.BodyPart.RightLeg
  36.     local leftl = Instance.new("CharacterMesh",Figure) leftl.MeshId="1112275294" leftl.BodyPart=Enum.BodyPart.LeftLeg
  37.  
  38.  
  39.  
  40. local Head = waitForChild(Figure, "head")
  41.  
  42. -- functions
  43.  
  44.  
  45.  
  46. local toolAnim = "None"
  47. local toolAnimTime = 0
  48.  
  49. -- functions
  50.  
  51. function onRunning(speed)
  52.     if speed>0 then
  53.         pose = "Running"
  54.     else
  55.         pose = "Standing"
  56.     end
  57. end
  58.  
  59. function onDied()
  60.     pose = "Dead"
  61. end
  62.  
  63. function onJumping(state)
  64.     pose = "Jumping"
  65. end
  66.  
  67. function onClimbing()
  68.     pose = "Climbing"
  69. end
  70.  
  71. function onGettingUp(state)
  72.     pose = "GettingUp"
  73. end
  74.  
  75. function onFreeFall(state)
  76.     pose = "FreeFall"
  77. end
  78.  
  79. function onFallingDown(state)
  80.     pose = "FallingDown"
  81. end
  82.  
  83. function onSeated()
  84.     pose = "Seated"
  85. end
  86.  
  87. function moveJump()
  88.     RightShoulder.MaxVelocity = 0.5
  89.     LeftShoulder.MaxVelocity = 0.5
  90.     RightShoulder.DesiredAngle = 3.14
  91.     LeftShoulder.DesiredAngle = -3.14
  92.     RightHip.DesiredAngle = 0
  93.     LeftHip.DesiredAngle = 0
  94. end
  95.  
  96.  
  97. -- same as jump for now
  98.  
  99. function moveFreeFall()
  100.     RightShoulder.MaxVelocity = 0.5
  101.     LeftShoulder.MaxVelocity = 0.5
  102.     RightShoulder.DesiredAngle = 3.14
  103.     LeftShoulder.DesiredAngle = -3.14
  104.     RightHip.DesiredAngle = 0
  105.     LeftHip.DesiredAngle = 0
  106. end
  107.  
  108. function moveSit()
  109.     RightShoulder.MaxVelocity = 0.15
  110.     LeftShoulder.MaxVelocity = 0.15
  111.     RightShoulder.DesiredAngle = 3.14 /2
  112.     LeftShoulder.DesiredAngle = -3.14 /2
  113.     RightHip.DesiredAngle = 3.14 /2
  114.     LeftHip.DesiredAngle = -3.14 /2
  115. end
  116.  
  117. local function getTool()
  118.     for i, v in ipairs(Figure:GetChildren()) do
  119.         if v:IsA"Tool" then
  120.             return v
  121.         end
  122.     end
  123.     return nil
  124. end
  125.  
  126. function getToolAnim(tool)
  127.     for _, c in ipairs(tool:GetChildren()) do
  128.         if c.Name == "toolanim" and c.className == "StringValue" then
  129.             return c
  130.         end
  131.     end
  132.     return nil
  133. end
  134.  
  135. function animateTool()
  136.    
  137.     if (toolAnim == "None") then
  138.         RightShoulder.DesiredAngle = 1.57
  139.         return
  140.     end
  141.  
  142.     if (toolAnim == "Slash") then
  143.         RightShoulder.MaxVelocity = 0.5
  144.         RightShoulder.DesiredAngle = 0
  145.         return
  146.     end
  147.  
  148.     if (toolAnim == "Lunge") then
  149.         RightShoulder.MaxVelocity = 0.5
  150.         LeftShoulder.MaxVelocity = 0.5
  151.         RightHip.MaxVelocity = 0.5
  152.         LeftHip.MaxVelocity = 0.5
  153.         RightShoulder.DesiredAngle = 1.57
  154.         LeftShoulder.DesiredAngle = 1.0
  155.         RightHip.DesiredAngle = 1.57
  156.         LeftHip.DesiredAngle = 1.0
  157.         return
  158.     end
  159. end
  160.  
  161. function move(time)
  162.     local amplitude
  163.     local frequency
  164.  
  165.     if (pose == "Jumping") then
  166.         moveJump()
  167.         return
  168.     end
  169.  
  170.     if (pose == "FreeFall") then
  171.         moveFreeFall()
  172.         return
  173.     end
  174.  
  175.     if (pose == "Seated") then
  176.         moveSit()
  177.         return
  178.     end
  179.  
  180.     local climbFudge = 0
  181.    
  182.     if (pose == "Running") then
  183.         RightShoulder.MaxVelocity = 0.15
  184.         LeftShoulder.MaxVelocity = 0.15
  185.         amplitude = 1
  186.         frequency = 9
  187.     elseif (pose == "Climbing") then
  188.         RightShoulder.MaxVelocity = 0.5
  189.         LeftShoulder.MaxVelocity = 0.5
  190.         amplitude = 1
  191.         frequency = 9
  192.         climbFudge = 3.14
  193.     else
  194.         amplitude = 0.1
  195.         frequency = 1
  196.     end
  197.  
  198.     desiredAngle = amplitude * math.sin(time*frequency)
  199.  
  200.     RightShoulder.DesiredAngle = desiredAngle + climbFudge
  201.     LeftShoulder.DesiredAngle = desiredAngle - climbFudge
  202.     RightHip.DesiredAngle = -desiredAngle
  203.     LeftHip.DesiredAngle = -desiredAngle
  204.  
  205.  
  206.     local tool = getTool()
  207.  
  208.     if tool then
  209.    
  210.         animStringValueObject = getToolAnim(tool)
  211.  
  212.         if animStringValueObject then
  213.             toolAnim = animStringValueObject.Value
  214.             -- message recieved, delete StringValue
  215.             animStringValueObject.Parent = nil
  216.             toolAnimTime = time + .3
  217.         end
  218.  
  219.         if time > toolAnimTime then
  220.             toolAnimTime = 0
  221.             toolAnim = "None"
  222.         end
  223.  
  224.         animateTool()
  225.  
  226.        
  227.     else
  228.         toolAnim = "None"
  229.         toolAnimTime = 0
  230.     end
  231. end
  232.  
  233.  
  234. -- connect events
  235.  
  236. Humanoid.Died:connect(onDied)
  237. Humanoid.Running:connect(onRunning)
  238. Humanoid.Jumping:connect(onJumping)
  239. Humanoid.Climbing:connect(onClimbing)
  240. Humanoid.GettingUp:connect(onGettingUp)
  241. Humanoid.FreeFalling:connect(onFreeFall)
  242. Humanoid.FallingDown:connect(onFallingDown)
  243. Humanoid.Seated:connect(onSeated)
  244.  
  245.  
  246.  
  247. -- main program
  248.  
  249. local runService = game:service("RunService");
  250. while Figure.Parent~=nil do
  251.     local _, time = wait(0.1)
  252.     move(time)
  253. end
  254.    
  255.     ]],player.Backpack)
  256. end
  257.  
  258.  
  259. function char()
  260.  
  261.     name = math.random()..math.random()..math.random()
  262.     local mod = Instance.new("Model",workspace) mod.Name = name
  263.     local torso = Instance.new(partmat[math.random(1,#partmat)],mod) torso.CFrame = oldpos.CFrame torso.Name="HumanoidRootPart" torso.Size = Vector3.new(2,2,1)torso.Reflectance = 0 torso.CanCollide=true torso.Transparency=0 torso.BrickColor=BrickColor.new("New Yeller")
  264.     local head = Instance.new(partmat[math.random(1,#partmat)],mod) head.Name="head" head.Size = Vector3.new(2,1,1)    local dec = Instance.new("Decal",head) dec.Texture="http://www.roblox.com/asset/?id=231473182" dec.Name=math.random() head.CanCollide=false  head.Reflectance=0 head.Transparency=0 head.BrickColor=BrickColor.new("Br. yellowish green")
  265.     local mesh = Instance.new("SpecialMesh",head) mesh.MeshId="rbxassetid://1104623876" mesh.Scale = Vector3.new(1.25, 1.25, 1.25)
  266.     local r_leg = Instance.new(partmat[math.random(1,#partmat)],mod) r_leg.Name="Right Leg" r_leg.Size = Vector3.new(1,2,1)  r_leg.Reflectance = 0 r_leg.CanCollide=false r_leg.Transparency=0 r_leg.BrickColor=BrickColor.new("New Yeller")
  267.     local l_leg = Instance.new(partmat[math.random(1,#partmat)],mod) l_leg.Name="Left Leg" l_leg.Size = Vector3.new(1,2,1)   l_leg.Reflectance = 0 l_leg.CanCollide=false l_leg.Transparency=0 l_leg.BrickColor=BrickColor.new("New Yeller")
  268.     local l_arm = Instance.new(partmat[math.random(1,#partmat)],mod) l_arm.Name="Left Arm" l_arm.Size = Vector3.new(1,2,1)   l_arm.Reflectance = 0 l_arm.CanCollide=false l_arm.Transparency=0 l_arm.BrickColor=BrickColor.new("Br. yellowish green")
  269.     local r_arm = Instance.new(partmat[math.random(1,#partmat)],mod) r_arm.Name="Right Arm" r_arm.Size = Vector3.new(1,2,1)  r_arm.Reflectance = 0 r_arm.CanCollide=false r_arm.Transparency=0 r_arm.BrickColor=BrickColor.new("Br. yellowish green")
  270.  
  271.  
  272.     function waitForChild(parent, childName)
  273.         local child = parent:findFirstChild(childName)
  274.         if child then return child end
  275.         while true do
  276.             child = parent.ChildAdded:wait()
  277.             if child.Name==childName then return child end
  278.         end
  279.     end
  280.  
  281.  
  282.     local Figure = mod
  283.     local Torso = waitForChild(Figure, "HumanoidRootPart")
  284.  
  285.     function makeJoint(limbName, jointName, c0, c1)
  286.         local limb = waitForChild(Figure, limbName)
  287.         limb:BreakJoints()
  288.         local joint = Instance.new"Motor"
  289.         joint.Name = jointName
  290.         joint.Part0 = Torso
  291.         joint.Part1 = limb
  292.         joint.C0 = c0
  293.         joint.C1 = c1
  294.         joint.MaxVelocity = 0.15
  295.         joint.archivable = false
  296.         joint.Parent = Torso
  297.         return joint
  298.     end
  299.  
  300.     local Neck = makeJoint("head","Neck", CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0))
  301.     local RightShoulder = makeJoint("Right Arm", "Right Shoulder", CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
  302.     local LeftShoulder = makeJoint("Left Arm", "Left Shoulder", CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
  303.     local RightHip = makeJoint("Right Leg", "Right Hip", CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
  304.     local LeftHip = makeJoint("Left Leg", "Left Hip", CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
  305.  
  306.  
  307.  
  308.  
  309.     oldpos = torso
  310.     player.Character = mod
  311.     wait()
  312.     all()
  313. end
  314.  
  315.  
  316. if player.Character then
  317.  
  318.     local h = player.Character:FindFirstChild("HumanoidRootPart")
  319.     if h then
  320.         oldpos = h
  321.         char()
  322.     else
  323.         local hez = player.Character:FindFirstChild("Head")
  324.         if hez then
  325.             oldpos = hez
  326.             char()
  327.         else
  328.             char()
  329.         end
  330.     end
  331. else
  332.     char()
  333. end
  334.  
  335.  
  336.  
  337. local run = game:GetService("RunService")
  338. local sec = 5
  339. run.Heartbeat:Connect(function(WHAT)
  340.     local nice = sec * WHAT
  341.     local oo =  workspace:FindFirstChild(name)
  342.     if oo then
  343.         local h = oo:FindFirstChild("head")
  344.         if h then
  345.         else
  346.             char()
  347.         end
  348.         local Rl = oo:FindFirstChild("Right Leg")
  349.         if Rl then
  350.         else
  351.             char()
  352.         end
  353.         local Ll = oo:FindFirstChild("Left Leg")
  354.         if Ll then
  355.         else
  356.             char()
  357.         end
  358.         local Larm = oo:FindFirstChild("Left Arm")
  359.         if Larm then
  360.         else
  361.             char()
  362.         end
  363.         local Rarm = oo:FindFirstChild("Right Arm")
  364.         if Rarm then
  365.         else
  366.             char()
  367.         end
  368.         local T = oo:FindFirstChild("HumanoidRootPart")
  369.         if T then
  370.         else
  371.             char()
  372.         end
  373.     else
  374.         char()
  375.     end
  376. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement