Gametoy

OOoo

Feb 10th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.83 KB | None | 0 0
  1. local Player, Character, Mouse = game:service("Players").LocalPlayer, game:GetService("Players").LocalPlayer.Character, game:GetService("Players").LocalPlayer:GetMouse();
  2. local Torso = Character:FindFirstChild("Torso")
  3. local rootPart = Character:FindFirstChild("HumanoidRootPart")
  4. local Humanoid = Character:FindFirstChild("Humanoid")
  5. local Head = Character:FindFirstChild("Head")
  6. local Right_Arm = Character:FindFirstChild("Right Arm")
  7. local Left_Arm = Character:FindFirstChild("Left Arm")
  8. local Right_Leg = Character:FindFirstChild("Right Leg")
  9. local Left_Leg = Character:FindFirstChild("Left Leg")
  10. local Right_Shoulder = Torso:FindFirstChild("Right Shoulder")
  11. local Left_Shoulder = Torso:FindFirstChild("Left Shoulder")
  12. local Right_Hip = Torso:FindFirstChild("Right Hip")
  13. local Left_Hip = Torso:FindFirstChild("Left Hip")
  14. local Neck = Torso:FindFirstChild("Neck")
  15. local rootPart = Character:FindFirstChild("HumanoidRootPart")
  16. local rootJoint = rootPart:FindFirstChild("RootJoint")
  17. local CurrentIdle = "Idling1"
  18. local Degree = 0.0175438596491228
  19. local canremove = false
  20. local debounce = false
  21. local UIService=game:GetService'UserInputService'
  22. _G.SongName = math.random(1,9025232)
  23. sin = math.sin
  24. Right_Leg.FormFactor = "Custom";
  25. Left_Leg.FormFactor = "Custom";
  26. rootPart.Archivable = true;
  27. rootJoint.Archivable = true;
  28. c_new = CFrame.new;
  29. c_angles = CFrame.Angles;
  30. i_new = Instance.new
  31. Humanoid:ClearAllChildren();
  32. local isAttacking = false
  33. local isSprinting = false
  34. local Animations = false
  35. local Angle = 0
  36. local Axis = 0
  37. local angleSpeed = 1
  38. local axisSpeed = angleSpeed
  39. local currentAnim
  40. local levetatingheight = 3
  41. local WalkType = "Ground"
  42.  
  43. function Sound(parent,loop,vol,id)
  44. local s = Instance.new('Sound',parent)
  45. s.Looped = loop
  46. s.Volume = 3
  47. s.MaxDistance=200
  48. s.EmitterSize=20
  49. s.SoundId = 'rbxassetid://'..tostring(id)
  50. s:Play()
  51. if loop == false then
  52. wait(s.TimeLength)
  53. s:Destroy()
  54. end
  55. end
  56.  
  57. Sound(rootPart,true,1,513259608)
  58.  
  59. newWeld = function(wp0, wp1, wc0x, wc0y, wc0z)
  60. wld = Instance.new("Weld", wp1)
  61. wld.Part0 = wp0
  62. wld.Part1 = wp1
  63. wld.C0 = CFrame.new(wc0x, wc0y, wc0z)
  64. return wld
  65. end
  66.  
  67. function noOutline(part)
  68. part.TopSurface, part.BottomSurface, part.LeftSurface, part.RightSurface, part.FrontSurface, part.BackSurface = 10, 10, 10, 10, 10, 10
  69. end
  70.  
  71. local function Part(Name,Color, Material, Transparency,Shape, Size, CFrame,CanCollide,Anchored,parent)
  72. local partie = i_new("Part",parent)
  73. partie.Name=Name
  74. partie.BrickColor = BrickColor.new(Color)
  75. partie.Material = Material
  76. partie.Shape = Shape
  77. partie.Transparency = Transparency
  78. partie.Size = Size
  79. partie.CFrame = CFrame
  80. partie.CanCollide = CanCollide
  81. partie.Anchored = Anchored
  82. return partie
  83. end
  84.  
  85.  
  86.  
  87. function swait(num)
  88. if num == 0 or num == nil then
  89. game:GetService("RunService").Stepped:wait(0)
  90. else
  91. for i = 0, num do
  92. game:GetService("RunService").Stepped:wait(0)
  93. end
  94. end
  95. end
  96.  
  97. function mesh(Mesh, part, meshtype, meshid, offset, scale)
  98. local mesh = i_new(Mesh)
  99. mesh.Parent = part
  100. if Mesh == "SpecialMesh" then
  101. mesh.MeshType = meshtype
  102. mesh.MeshId = meshid
  103. end
  104. mesh.Offset = offset
  105. mesh.Scale = scale
  106. return mesh
  107. end
  108.  
  109. function rayCast(Pos, Dir, Max, Ignore) -- Origin Position, Direction, MaxDistance, IgnoreDescendants
  110. return game:GetService("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore)
  111. end
  112.  
  113. function QuaternionFromCFrame(cf)
  114. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  115. local trace = m00 + m11 + m22
  116. if trace > 0 then
  117. local s = math.sqrt(1 + trace)
  118. local recip = 0.5/s
  119. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  120. else
  121. local i = 0
  122. if m11 > m00 then
  123. i = 1
  124. end
  125. if m22 > (i == 0 and m00 or m11) then
  126. i = 2
  127. end
  128. if i == 0 then
  129. local s = math.sqrt(m00-m11-m22+1)
  130. local recip = 0.5/s
  131. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  132. elseif i == 1 then
  133. local s = math.sqrt(m11-m22-m00+1)
  134. local recip = 0.5/s
  135. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  136. elseif i == 2 then
  137. local s = math.sqrt(m22-m00-m11+1)
  138. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  139. end
  140. end
  141. end
  142.  
  143. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  144. local xs, ys, zs = x + x, y + y, z + z
  145. local wx, wy, wz = w*xs, w*ys, w*zs
  146. local xx = x*xs
  147. local xy = x*ys
  148. local xz = x*zs
  149. local yy = y*ys
  150. local yz = y*zs
  151. local zz = z*zs
  152. return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
  153. end
  154.  
  155. function QuaternionSlerp(a, b, t)
  156. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  157. local startInterp, finishInterp;
  158. if cosTheta >= 0.0001 then
  159. if (1 - cosTheta) > 0.0001 then
  160. local theta = math.acos(cosTheta)
  161. local invSinTheta = 1/math.sin(theta)
  162. startInterp = math.sin((1-t)*theta)*invSinTheta
  163. finishInterp = math.sin(t*theta)*invSinTheta
  164. else
  165. startInterp = 1-t
  166. finishInterp = t
  167. end
  168. else
  169. if (1+cosTheta) > 0.0001 then
  170. local theta = math.acos(-cosTheta)
  171. local invSinTheta = 1/math.sin(theta)
  172. startInterp = math.sin((t-1)*theta)*invSinTheta
  173. finishInterp = math.sin(t*theta)*invSinTheta
  174. else
  175. startInterp = t-1
  176. finishInterp = t
  177. end
  178. end
  179. return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
  180. end
  181.  
  182. function clerp(a, b, t)
  183. local qa = {QuaternionFromCFrame(a)}
  184. local qb = {QuaternionFromCFrame(b)}
  185. local ax, ay, az = a.x, a.y, a.z
  186. local bx, by, bz = b.x, b.y, b.z
  187. local _t = 1-t
  188. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  189. end
  190.  
  191. swait()
  192. LA_Weld = newWeld(Torso, Left_Arm, -1.5, 0.5, 0)
  193. Left_Arm.Weld.C1 = CFrame.new(0, 0.5, 0)
  194. RA_Weld = newWeld(Torso, Right_Arm, 1.5, 0.5, 0)
  195. Right_Arm.Weld.C1 = CFrame.new(0, 0.5, 0)
  196. LL_Weld = newWeld(Torso, Left_Leg, -0.5, -1, 0)
  197. Left_Leg.Weld.C1 = CFrame.new(0, 1, 0) -- Left_Leg.Weld.C1 = CFrame.new(0, 1, 0.15)
  198. RL_Weld = newWeld(Torso, Right_Leg, 0.5, -1, 0)
  199. Right_Leg.Weld.C1 = CFrame.new(0, 1, 0) -- Right_Leg.Weld.C1 = CFrame.new(0, 1, 0.15)
  200. Torso_Weld = newWeld(rootPart, Torso, 0, -1, 0)
  201. Torso.Weld.C1 = CFrame.new(0, -1, 0)
  202. Head_Weld = newWeld(Torso, Head, 0, 1.5, 0)
  203. --Part(Name,Color, Material, Transparency,Shape, Size, CFrame,CanCollide,Anchored,parent)
  204. --newWeld(wp0, wp1, wc0x, wc0y, wc0z)
  205. local REye=Part('REye','Royal purple','Neon',0,'Ball',Vector3.new(.1,.1,.1),CFrame.new(0,0,0),false,false,Character)
  206. newWeld(Head,REye,.2,.225,-.5)
  207. local REGlow=Instance.new('SurfaceLight')
  208. REGlow.Color=Color3.fromRGB(170,85,255)
  209. REGlow.Range=30
  210. REGlow.Brightness=100000
  211. REGlow.Parent=REye
  212. local Glow=Instance.new('ParticleEmitter')
  213. Glow.Color=ColorSequence.new(Color3.fromRGB(251,0,255),Color3.fromRGB(255,255,255))
  214. Glow.Texture='rbxassetid://242292318'
  215. Glow.Transparency=NumberSequence.new(.9)
  216. Glow.Size=NumberSequence.new(.225)
  217. Glow.Acceleration=Vector3.new(45,30,0)
  218. Glow.LockedToPart=true
  219. Glow.Lifetime=NumberRange.new(.25,.25)
  220. Glow.Rate=1000
  221. Glow.EmissionDirection='Bottom'
  222. Glow.Speed=NumberRange.new(1,1)
  223. Glow.ZOffset=2
  224. Glow.Parent=REye
  225. local LEye=Part('LEye','Royal purple','Neon',0,'Ball',Vector3.new(.1,.1,.1),CFrame.new(0,0,0),false,false,Character)
  226. newWeld(Head,LEye,-.2,.225,-.5)
  227. local LEGlow=Instance.new('SurfaceLight')
  228. LEGlow.Color=Color3.fromRGB(170,85,255)
  229. LEGlow.Range=6
  230. LEGlow.Brightness=10
  231. LEGlow.Parent=LEye
  232. sine = 0
  233. change = 1
  234. sprint=false
  235. local punches={
  236. a=false,
  237. b=false,
  238. c=false
  239. }
  240.  
  241. UIService.InputBegan:connect(function(Input,GUIProcessed)
  242. if not GUIProcessed and Input.UserInputType==Enum.UserInputType.MouseButton1 then
  243. if punches.a==false then
  244. punches.a=true wait(.4) punches.a=false
  245. else
  246. punches.a=true
  247. print('a ',punches.a)
  248. if punches.b==false then
  249. punches.b=true wait(.4) punches.b=false
  250. else
  251. punches.b=true
  252. print('b ',punches.b)
  253. if punches.c==false then
  254. punches.c=true wait(.4) punches.c=false
  255. else
  256. punches.c=true
  257. print('c ',punches.c)
  258. print('a ',punches.a,'b ',punches.b,'c ',punches.c)
  259. end
  260. end
  261. end
  262. elseif not GUIProcessed and Input.KeyCode==Enum.KeyCode.LeftShift then
  263. sprint=true
  264. end
  265. end)
  266.  
  267. UIService.InputEnded:connect(function(Input,GUIProcessed)
  268. if not GUIProcessed and Input.KeyCode==Enum.KeyCode.LeftShift then
  269. sprint=false
  270. end
  271. end)
  272.  
  273. game:GetService("RunService").RenderStepped:connect(function()
  274. Angle = (Angle % 100) + angleSpeed/10
  275. Axis = (Axis % 100) + axisSpeed/10
  276. walkingMagnitude = Vector3.new(rootPart.Velocity.X, 0, rootPart.Velocity.Z).magnitude
  277. jumpVel = Torso.Velocity.Y
  278. sine = change + sine
  279.  
  280. if(Humanoid.Jump) and jumpVel > 1 then
  281. currentAnim = "Jumping"
  282. elseif walkingMagnitude < 2 then
  283. currentAnim = "Idling"
  284. elseif isSprinting == true then
  285. currentAnim = "Sprinting"
  286. elseif walkingMagnitude > 2 then
  287. currentAnim = "Walking"
  288. elseif isAttacking == true then
  289. currentAnim = "Attacking"
  290. end
  291.  
  292. if currentAnim == "Jumping" and Animations == false then
  293. angleSpeed = 2
  294. axisSpeed = 2
  295. RA_Weld.C0 = clerp(RA_Weld.C0, c_new(1.5, 0.5, 0) * c_angles(math.rad(0), math.rad(0), math.rad(0)), 0.15)
  296. LA_Weld.C0 = clerp(LA_Weld.C0, c_new(-1.5, 0.5, 0) * c_angles(math.rad(0), math.rad(0), math.rad(0)), 0.15)
  297. LL_Weld.C0 = clerp(LL_Weld.C0, c_new(-0.5, -1, 0) * c_angles(math.rad(0), math.rad(0), math.rad(0)), 0.15)
  298. RL_Weld.C0 = clerp(RL_Weld.C0, c_new(0.5, -1, 0) * c_angles(math.rad(0), math.rad(0), math.rad(0)), 0.15)
  299. Torso_Weld.C0 = clerp(Torso_Weld.C0, c_new(0, -1, 0) * c_angles(math.rad(0), math.rad(0), math.rad(0)), 0.15)
  300. Head_Weld.C0 = clerp(Head_Weld.C0, c_new(0, 1.5, 0) * c_angles(math.rad(0), math.rad(0), math.rad(0)), 0.15)
  301. elseif currentAnim == "Idling" and Animations == false then
  302. angleSpeed = 1
  303. axisSpeed = 1
  304. change = 0.5
  305. RA_Weld.C0 = clerp(RA_Weld.C0, c_new(1.5, .5, 0) * c_angles(math.rad(45), math.rad(-3), math.rad(-10)), 0.15)
  306. LA_Weld.C0 = clerp(LA_Weld.C0, c_new(-1.5, 0.5, 0) * c_angles(math.rad(45), math.rad(5), math.rad(20)), 0.15)
  307. LL_Weld.C0 = clerp(LL_Weld.C0, c_new(-0.5, -1, 0) * c_angles(math.rad(85), math.rad(0), math.rad(-20)), 0.15)
  308. RL_Weld.C0 = clerp(RL_Weld.C0, c_new(0.5, -1, 0) * c_angles(math.rad(85), math.rad(0), math.rad(30)), 0.15)
  309. Torso_Weld.C0 = clerp(Torso_Weld.C0, c_new(0, -2.5, 0) * c_angles(math.rad(10), math.rad(0), math.rad(0)), 0.15)
  310. Head_Weld.C0 = clerp(Head_Weld.C0, c_new(0, 1.5, 0) * c_angles(math.rad(0), math.rad(0), math.rad(0)), 0.15)
  311. elseif currentAnim == "Walking" and Animations == false then
  312. if sprint==false then
  313. angleSpeed = 1
  314. axisSpeed = 1
  315. Humanoid.WalkSpeed = 16
  316. RA_Weld.C0 = clerp(RA_Weld.C0, c_new(1.5, 0.5, 0) * c_angles(math.rad(0), -math.sin((rootPart.RotVelocity.X/5))/2, math.sin((-rootPart.RotVelocity.Y/5))/2), 0.15)
  317. LA_Weld.C0 = clerp(LA_Weld.C0, c_new(-1.5, 0.5, 0) * c_angles(math.rad(0), math.sin((rootPart.RotVelocity.X/5))/2, -math.sin((-rootPart.RotVelocity.Y/5))/2), 0.15)
  318. LL_Weld.C0 = clerp(LL_Weld.C0, c_new(-0.5, -1, 0) * c_angles(math.sin(sine/2)/1.5, math.sin((rootPart.RotVelocity.Y/5))/2, -math.sin((rootPart.RotVelocity.Y/5))/2), 0.15)
  319. RL_Weld.C0 = clerp(RL_Weld.C0, c_new(0.5, -1, 0) * c_angles(-math.sin(sine/2)/1.5, -math.sin((rootPart.RotVelocity.Y/5))/2, math.sin((-rootPart.RotVelocity.Y/5))/2), 0.15)
  320. Torso_Weld.C0 = clerp(Torso_Weld.C0, c_new(0, -1, 0) * c_angles(math.rad(0), math.rad(0), math.sin((rootPart.RotVelocity.Y/30))/2), 0.15)
  321. Head_Weld.C0 = clerp(Head_Weld.C0, c_new(0, 1.5, 0) * c_angles(math.rad(0), math.sin((rootPart.RotVelocity.Y/2.5))/2, math.rad(0)), 0.15)
  322. else
  323. angleSpeed = 10
  324. axisSpeed = 10
  325. Humanoid.WalkSpeed = 60
  326. RA_Weld.C0 = clerp(RA_Weld.C0, c_new(1.5, 0.5, 0) * c_angles(math.rad(-40)+(-math.sin(sine/20)/5), -math.sin((rootPart.RotVelocity.X/3))/2, math.sin((-rootPart.RotVelocity.Y/3))/2), 0.15)
  327. LA_Weld.C0 = clerp(LA_Weld.C0, c_new(-1.5, 0.5, 0) * c_angles(math.rad(-40)+(-math.sin(sine/20)/5), math.sin((rootPart.RotVelocity.X/3))/2, -math.sin((-rootPart.RotVelocity.Y/3))/2), 0.15)
  328. LL_Weld.C0 = clerp(LL_Weld.C0, c_new(-0.5, -1, 0) * c_angles(math.sin(sine/1)/1, math.sin((rootPart.RotVelocity.Y/3))/2, -math.sin((rootPart.RotVelocity.Y/3))/2), 0.15)
  329. RL_Weld.C0 = clerp(RL_Weld.C0, c_new(0.5, -1, 0) * c_angles(-math.sin(sine/1)/1, -math.sin((rootPart.RotVelocity.Y/3))/2, math.sin((-rootPart.RotVelocity.Y/3))/2), 0.15)
  330. Torso_Weld.C0 = clerp(Torso_Weld.C0, c_new(0, -1, 0) * c_angles(math.rad(-20), math.rad(0), math.sin((rootPart.RotVelocity.Y/15))/2), 0.15)
  331. Head_Weld.C0 = clerp(Head_Weld.C0, c_new(0, 1.5, 0) * c_angles(math.rad(0), math.sin((rootPart.RotVelocity.Y/1))/2, math.rad(0)), 0.15)
  332. end
  333. end
  334. end)
Add Comment
Please, Sign In to add comment