Guest User

Help

a guest
Feb 17th, 2016
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.13 KB | None | 0 0
  1. local Player = game.Players.LocalPlayer  --Get the player
  2. Mouse = Player:GetMouse()           --Get the mouse
  3. local cam = workspace.CurrentCamera
  4. local rdoll = false
  5. print("Hello world!")
  6. name = Player.Name.."doll"
  7. Character = script.Parent
  8. Humanoid = Character.Humanoid
  9. Torso = Character.Torso
  10.  
  11.     Mouse.KeyDown:connect(function(Key)
  12.             if (Key:lower() == "r") then            --Pick key to use
  13. OnDeath()
  14.         end                                  --End if                                    --End if
  15.     if (Key:lower() == "f") then            --Pick key to use
  16.         rdoll = false
  17. Fix()
  18.     end         end)
  19.    
  20. function Fix()
  21.     print("Fixing")
  22.     game.Lighting.Humanoid.Parent = game.Players.LocalPlayer.Character
  23.     game.Players.LocalPlayer.Character.Parent = game.Workspace
  24.     game.Players.LocalPlayer.Character:MakeJoints()
  25. end
  26. function OnDeath()
  27.    
  28.     print("Death")--  HAHA
  29.     rdoll = true
  30.         wait(0.00000001)
  31.         Humanoid.Parent = game.Lighting
  32. mode = Instance.new("Model")
  33. mode.Name = name
  34. mode.Parent = game.Workspace
  35.     if Torso then
  36.         zam=Torso:Clone()
  37.         zam.Parent=mode
  38.         x=Character:GetChildren()
  39.         for i=1,#x do
  40.         if ((x[i].Name=="Shirt") or (x[i].Name=="Pants")) then
  41.             local zor=x[i]:Clone()
  42.             zor.Parent=mode
  43.         end
  44.         if x[i].Name=="Head" then
  45.             local zem=x[i]:Clone()
  46.             zem.Parent=mode
  47.             zem.Name="notahead"
  48.             local Neck = Instance.new("Weld")
  49.             Neck.Name = "Neck"
  50.             Neck.Part0 = zam
  51.             Neck.Part1 = zem
  52.             Neck.C0 = CFrame.new(0, 1.5, 0)
  53.             Neck.C1 = CFrame.new()
  54.             Neck.Parent = zam
  55.         end
  56.         if x[i].Name=="Right Arm" then
  57.             local Limb=x[i]:Clone()
  58.             Limb.Parent=mode
  59.             Limb.CFrame = zam.CFrame * CFrame.new(1.5, 0, 0)
  60.             local Joint = Instance.new("Glue")
  61.             Joint.Name = "RightShoulder"
  62.             Joint.Part0 = zam
  63.             Joint.Part1 = Limb
  64.             Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  65.             Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  66.             Joint.Parent = zam
  67.  
  68.             local B = Instance.new("Part")
  69.             B.TopSurface = 0
  70.             B.BottomSurface = 0
  71.             B.formFactor = "Symmetric"
  72.             B.Size = Vector3.new(1, 1, 1)
  73.             B.Transparency = 1
  74.             B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  75.             B.Parent = mode
  76.             local W = Instance.new("Weld")
  77.             W.Part0 = Limb
  78.             W.Part1 = B
  79.             W.C0 = CFrame.new(0, -0.5, 0)
  80.             W.Parent = Limb
  81.  
  82.         end
  83.         if x[i].Name=="Left Arm" then
  84.             local Limb=x[i]:Clone()
  85.             Limb.Parent=mode
  86.  
  87.             Limb.CFrame = zam.CFrame * CFrame.new(-1.5, 0, 0)
  88.             local Joint = Instance.new("Glue")
  89.             Joint.Name = "LeftShoulder"
  90.             Joint.Part0 = zam
  91.             Joint.Part1 = Limb
  92.             Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  93.             Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  94.             Joint.Parent = zam
  95.  
  96.             local B = Instance.new("Part")
  97.             B.TopSurface = 0
  98.             B.BottomSurface = 0
  99.             B.formFactor = "Symmetric"
  100.             B.Size = Vector3.new(1, 1, 1)
  101.             B.Transparency = 1
  102.             B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  103.             B.Parent = mode
  104.             local W = Instance.new("Weld")
  105.             W.Part0 = Limb
  106.             W.Part1 = B
  107.             W.C0 = CFrame.new(0, -0.5, 0)
  108.             W.Parent = Limb
  109.  
  110.         end
  111.         if x[i].Name=="Right Leg" then
  112.             local Limb=x[i]:Clone()
  113.             Limb.Parent=mode
  114.  
  115.             Limb.CFrame = zam.CFrame * CFrame.new(0.5, -2, 0)
  116.             local Joint = Instance.new("Glue")
  117.             Joint.Name = "RightHip"
  118.             Joint.Part0 = zam
  119.             Joint.Part1 = Limb
  120.             Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  121.             Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  122.             Joint.Parent = zam
  123.  
  124.             local B = Instance.new("Part")
  125.             B.TopSurface = 0
  126.             B.BottomSurface = 0
  127.             B.formFactor = "Symmetric"
  128.             B.Size = Vector3.new(1, 1, 1)
  129.             B.Transparency = 1
  130.             B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  131.             B.Parent = mode
  132.             local W = Instance.new("Weld")
  133.             W.Part0 = Limb
  134.             W.Part1 = B
  135.             W.C0 = CFrame.new(0, -0.5, 0)
  136.             W.Parent = Limb
  137.  
  138.         end
  139.         if x[i].Name=="Left Leg" then
  140.             local Limb=x[i]:Clone()
  141.             Limb.Parent=mode
  142.  
  143.             Limb.CFrame = zam.CFrame * CFrame.new(-0.5, -2, 0)
  144.             local Joint = Instance.new("Glue")
  145.             Joint.Name = "LeftHip"
  146.             Joint.Part0 = zam
  147.             Joint.Part1 = Limb
  148.             Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  149.             Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  150.             Joint.Parent = zam
  151.  
  152.             local B = Instance.new("Part")
  153.             B.TopSurface = 0
  154.             B.BottomSurface = 0
  155.             B.formFactor = "Symmetric"
  156.             B.Size = Vector3.new(1, 1, 1)
  157.             B.Transparency = 1
  158.             B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  159.             B.Parent = mode
  160.             local W = Instance.new("Weld")
  161.             W.Part0 = Limb
  162.             W.Part1 = B
  163.             W.C0 = CFrame.new(0, -0.5, 0)
  164.             W.Parent = Limb
  165.  
  166.         end
  167.         bland=Instance.new("Humanoid")
  168.         bland.Parent=mode
  169.         if ((x[i].Name=="Shirt") or (x[i].Name=="Pants")) then
  170.             local zor=x[i]:Clone()
  171.             zor.Parent=mode
  172.         end
  173.         --[
  174.         local Bar = Instance.new("Part")
  175.         Bar.TopSurface = 0
  176.         Bar.BottomSurface = 0
  177.         Bar.formFactor = "Symmetric"
  178.         Bar.Size = Vector3.new(1, 1, 1)
  179.         Bar.Transparency = 1
  180.         Bar.CFrame = zam.CFrame * CFrame.new(0, 0.5, 0)
  181.         Bar.Parent = mode
  182.         local Weld = Instance.new("Weld")
  183.         Weld.Part0 = zam
  184.         Weld.Part1 = Bar
  185.         Weld.C0 = CFrame.new(0, 0.5, 0)
  186.         Weld.Parent = zam
  187.         --]]
  188.     end
  189.     end
  190.     wait()
  191.     gu = script.getup:Clone()
  192.     gu.Parent = game.Players.LocalPlayer.PlayerGui
  193.     gu.TextButton.refresh.Disabled = false
  194.     cam.CameraSubject= game.Workspace:FindFirstChild(Player.Name.."doll").Torso
  195.     Character.Parent = game.Lighting
  196.     Mouse.KeyDown:connect(function(Key)
  197.     if rdoll == true then
  198.     repeat if (Key:lower() == "w") then             --Pick key to use
  199.             local w = Instance.new("BodyThrust")
  200.             w.Parent =  game.Workspace:FindFirstChild(Player.Name.."doll").Torso
  201.             w.Name = "W"
  202.             w.Force = Vector3.new(16,0,0)
  203.                 repeat wait() until (Key:lower() == "w") == false
  204.             local w =  game.Workspace:FindFirstChild(Player.Name.."doll").Torso.W
  205.             w:Destroy() end until rdoll == false
  206. --if (Key:lower() == "s") then          --Pick key to use
  207. --      rdoll = false
  208. --Fix()
  209. --end                  
  210.     end          --End if                                    --End if                                            --End function
  211.  
  212.  
  213.              --Activated the KeyDown function with GetMouse                      --End if                                    --End if                                                        --End function
  214.  
  215. --Watch the tutorial on youtube ~ Safok
  216.  
  217.     end
  218.     )
  219.     end --Ragdoll script by Safok, Free will part by Noble
Advertisement
Add Comment
Please, Sign In to add comment