Advertisement
simhwui

Untitled

Aug 9th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.63 KB | None | 0 0
  1. aa1={}
  2. torso=game.Players.LocalPlayer.Character.Torso
  3.  
  4. local WorldUp = Vector3.new(0,1,0)
  5. function look2(Vec1,Vec2)
  6. local Orig = Vec1
  7. Vec1 = Vec1+Vector3.new(0,1,0)
  8. Vec2 = Vec2+Vector3.new(0,1,0)
  9. local Forward = (Vec2-Vec1).unit
  10. local Up = (WorldUp-WorldUp:Dot(Forward)*Forward).unit
  11. local Right = Up:Cross(Forward).unit
  12. Forward = -Forward
  13. Right = -Right
  14. return CFrame.new(Orig.X,Orig.Y,Orig.Z,Right.X,Up.X,Forward.X,Right.Y,Up.Y,Forward.Y,Right.Z,Up.Z,Forward.Z)
  15. end
  16.  
  17. function look(CFr,Vec2)
  18. local A = Vector3.new(0,0,0)
  19. local B = CFr:inverse()*Vec2
  20. local CF = look2(A,Vector3.new(A.X,B.Y,B.Z))
  21. if B.Z > 0 then
  22. CF = CFr*(CF*CFrame.Angles(0,0,math.pi))
  23. elseif B.Z == 0 then
  24. if B.Y > 0 then
  25. CF = CFr*CFrame.Angles(math.pi/2,0,0)
  26. elseif B.Y < 0 then
  27. CF = CFr*CFrame.Angles(-math.pi/2,0,0)
  28. else
  29. CF = CFr
  30. end
  31. end
  32. local _,_,_,_,X,_,_,Y,_,_,Z,_ = CF:components()
  33. local Up = Vector3.new(X,Y,Z)
  34. local Forward = (Vec2-CFr.p).unit
  35. local Right = Up:Cross(Forward)
  36. Forward = -Forward
  37. Right = -Right
  38. return CFrame.new(CFr.X,CFr.Y,CFr.Z,Right.X,Up.X,Forward.X,Right.Y,Up.Y,Forward.Y,Right.Z,Up.Z,Forward.Z)
  39. end
  40.  
  41. function simulate(j,d,m,r,t)
  42. local joint = j
  43. for i,v in ipairs(t) do
  44. if v[1]:FindFirstChild("Weld") then
  45. local stiff = m.CFrame.lookVector*0.03
  46. if i > 1 then joint = t[i-1][1].CFrame*CFrame.new(0,0,d*.5) end
  47. local dir = (v[2].p-(joint.p+Vector3.new(0,0.2,0)+stiff)).unit
  48. local dis = (v[2].p-(joint.p+Vector3.new(0,0.2,0)+stiff)).magnitude
  49. local pos = joint.p+(dir*(d*0.5))
  50. --if v[1].CFrame.y<=workspace.Base.CFrame.y then pos = joint.p+(dir*(d*.5)) end
  51. local inv = v[1].Weld.Part0.CFrame
  52. local rel1 = inv:inverse()*pos
  53. local rel2 = inv:inverse()*(pos-(dir*dis))
  54. local cf = look(CFrame.new(rel1),rel2)--CFrame.new(pos,pos-(dir*dis))*CFrame.fromEulerAnglesXYZ(r.x,r.y,r.z)
  55. v[1].Weld.C0 = cf
  56. v[2] = inv*cf
  57. --v[1].CFrame = cf
  58. end
  59. end
  60. end
  61. for i=1,8 do
  62. local p = Instance.new("Part",char)
  63. p.Anchored = false
  64. p.BrickColor = BrickColor.new("Institutional white")
  65. p.CanCollide = false
  66. p.FormFactor="Custom"
  67. p.Material = "SmoothPlastic"
  68. p.TopSurface = "SmoothNoOutlines"
  69. p.BottomSurface = "SmoothNoOutlines"
  70. p.RightSurface = "SmoothNoOutlines"
  71. p.LeftSurface = "SmoothNoOutlines"
  72. p.FrontSurface = "SmoothNoOutlines"
  73. p.BackSurface = "SmoothNoOutlines"
  74.  
  75. p.Size=Vector3.new(2,.2,0.2)
  76. p:BreakJoints() -- sometimes the parts are stuck to something so you have to breakjoints them
  77. mesh = Instance.new("BlockMesh",p)
  78. mesh.Scale = Vector3.new(1,1,4)
  79. local w = Instance.new("Motor6D",p)
  80. w.Part0 = aa1[i-1] and aa1[i-1][1] or torso
  81. w.Part1 = p
  82. w.Name = "Weld"
  83. --table.insert(aa1,p)
  84. aa1[i] = {p,p.CFrame}
  85.  
  86. end
  87. game:service"RunService".Stepped:connect(function()
  88. simulate(torso.CFrame*CFrame.new(0,0.9,.5),.6,torso,Vector3.new(),aa1)
  89. end)
  90. bb.AlwaysOnTop = true
  91. bb.Size = UDim2.new(0,200,0,50)
  92. bb.StudsOffset = Vector3.new(0,1,0)
  93. gui=Instance.new("TextBox",bb)
  94. gui.Text = "* "
  95. gui.Size = UDim2.new(0,133,0,45)
  96. gui.Position=UDim2.new(0,57,0,-40)
  97. gui.TextColor3 = Color3.new(255,255,255)
  98. gui.BackgroundColor3=Color3.new(0,0,0)
  99. gui.TextWrapped = true
  100. gui.TextScaled = true
  101. gui.TextXAlignment = "Left"
  102. gui.TextYAlignment = "Top"
  103. gui.Visible = false
  104. gui.BorderColor3 = Color3.new(0,0,0)
  105. punch2 = true
  106. gui1=Instance.new("TextButton",bb)
  107. gui1.Position=UDim2.new(0,5,0,-43)
  108. gui1.Size = UDim2.new(0,190,0,51)
  109.  
  110. gui1.TextColor3 = Color3.new(255,255,255)
  111. gui1.BackgroundColor3=Color3.new(255,255,255)
  112. jump2 = true
  113. gui1.Visible = false
  114. img = Instance.new("ImageLabel",bb)
  115. img.Size = UDim2.new(0,46,0,47)
  116. img.Position = UDim2.new(0,10,0,-41)
  117. img.Image = "rbxassetid://447301252"
  118. img.BorderColor3 = Color3.new(0,0,0)
  119. img.Visible = false
  120. soka = Instance.new("Sound",char)
  121. soka.SoundId = "http://www.roblox.com/asset/?id = 447199232"
  122. soka.Volume = 1
  123. boom = Instance.new("Sound",char)
  124. boom.SoundId = "http://www.roblox.com/asset/?id = 447041606"
  125. boom.Volume = 1
  126. boom2 = Instance.new("Sound",char)
  127. boom2.SoundId = "http://www.roblox.com/asset/?id = 449025737"
  128. boom2.Volume = 1
  129. boom3 = Instance.new("Sound",char)
  130. boom3.SoundId = "http://www.roblox.com/asset/?id = 450719019"
  131. boom3.Volume = 1
  132. tps = Instance.new("Sound",char)
  133. tps.SoundId = "http://www.roblox.com/asset/?id = 449860746"
  134. tps.Volume = 1
  135. asd = Instance.new("Sound",char)
  136. asd.SoundId = "http://www.roblox.com/asset/?id = 447310433"
  137. asd.Volume =1
  138. asd1 = Instance.new("Sound",char)
  139. asd1.SoundId = "http://www.roblox.com/asset/?id = 358280695"
  140.  
  141. asd2 = Instance.new("Sound",char)
  142. asd2.SoundId = "http://www.roblox.com/asset/?id = 386713054"
  143. asd2.Looped = true
  144. asd2.Volume = 5
  145. asd3 = Instance.new("Sound",char)
  146. asd3.SoundId = "http://www.roblox.com/asset/?id = 378387996"
  147. asd3.Looped = true
  148. asd4 = Instance.new("Sound",char)
  149. asd4.SoundId = "http://www.roblox.com/asset/?id = 401258325"
  150. asd4.Looped = true
  151. asd5 = Instance.new("Sound",char)
  152. asd5.SoundId = "http://www.roblox.com/asset/?id = 362252261"
  153. asd5.Looped = true
  154. gas = Instance.new("Sound",char)
  155. gas.SoundId = "http://www.roblox.com/asset/?id = 345052019"
  156. asd6 = Instance.new("Sound",char)
  157. asd6.SoundId = "http://www.roblox.com/asset/?id = 401258325"
  158. asd6.Looped = true
  159. function play(play)
  160. asd:Play()
  161. wait(0.05)
  162. --asd1:Play()
  163. end
  164.  
  165.  
  166.  
  167. ------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement