Advertisement
Awooslayer699

script creation. Edit tommorrow

Mar 25th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.79 KB | None | 0 0
  1. wait(0.2)
  2. local Player = game:GetService("Players").LocalPlayer
  3. local mouse = game:GetService("Players").LocalPlayer:Getmouse()
  4. local char = plr.Character
  5. local hum = char.Humanoid
  6. local hed = char.Head
  7. local root = char.HumanoidRootPart
  8. local rootj = root.RootJoint
  9. local tors = char.Torso
  10. local ra = char["Right Arm"]
  11. local la = char["Left Arm"]
  12. local rl = char["Right Leg"]
  13. local ll = char["Left Leg"]
  14. local neck = tors["Neck"]
  15. local RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
  16. local RHCF = CFrame.fromEulerAnglesXYZ(0, 1.6, 0)
  17. local LHCF = CFrame.fromEulerAnglesXYZ(0, -1.6, 0)
  18. local maincolor = BrickColor.new("Institutional white")
  19.  
  20. ------------------------------------------------
  21. -- Start Despacito--
  22. ------------------------------------------------
  23.  
  24. cam = game.workspace.CurrentCamera
  25. CF = CFrame.new
  26. Angles = CFrame.angles
  27. Attack = false
  28. Euler = CFrame.fromEulerAnglesXYZ
  29. Rad = math.rad
  30. IT = Instance.new
  31. BrickC = BrickColor.new
  32. Cos = math.cos
  33. Acos = math.acos
  34. Sin = math.sin
  35. Asin = math.asin
  36. Abs = math.abs
  37. Mrandom = math.random
  38. Floor = math.floor
  39. ------------------------------------------------
  40. --End Despacito--
  41. ------------------------------------------------
  42. RSH, LSH = nil, nil
  43. RW = Instance.new("Weld")
  44. LW = Instance.new("Weld")
  45. RH = tors["Right Hip"]
  46. LH = tors["Left Hip"]
  47. RSH = tors["Right Shoulder"]
  48. LSH = tors["Left Shoulder"]
  49. RSH.Parent = nil
  50. LSH.Parent = nil
  51. RW.Name = "RW"
  52. RW.Part0 = tors
  53. RW.C0 = CF(1.5, 0.5, 0)
  54. RW.C1 = CF(0, 0.5, 0)
  55. RW.Part1 = ra
  56. RW.Parent = tors
  57. LW.Name = "LW"
  58. LW.Part0 = tors
  59. LW.C0 = CF(-1.5, 0.5, 0)
  60. LW.C1 = CF(0, 0.5, 0)
  61. LW.Part1 = la
  62. LW.Parent = tors
  63. Effects = {}
  64. ----------------------------------------------------
  65. --Start Heartbeat--
  66. ----------------------------------------------------
  67. ArtificialHB = Instance.new("BindableEvent", script)
  68. ArtificialHB.Name = "Heartbeat"
  69. script:WaitForChild("Heartbeat")
  70.  
  71. frame = 1 / 60
  72. tf = 0
  73. allowframeloss = false
  74. tossremainder = false
  75.  
  76.  
  77. lastframe = tick()
  78. script.Heartbeat:Fire()
  79.  
  80.  
  81. game:GetService("RunService").Heartbeat:connect(function(s, p)
  82. tf = tf + s
  83. if tf >= frame then
  84. if allowframeloss then
  85. script.Heartbeat:Fire()
  86. lastframe = tick()
  87. else
  88. for i = 1, math.floor(tf / frame) do
  89. script.Heartbeat:Fire()
  90. end
  91. lastframe = tick()
  92. end
  93. if tossremainder then
  94. tf = 0
  95. else
  96. tf = tf - frame * math.floor(tf / frame)
  97. end
  98. end
  99. end)
  100. -----------------------------------------------------------
  101. --End HeartBeat--
  102. -----------------------------------------------------------
  103.  
  104. -------------------------------------------------------
  105. --Start Important Functions--
  106. -------------------------------------------------------
  107. function swait(num)
  108. if num == 0 or num == nil then
  109. game:service("RunService").Stepped:wait(0)
  110. else
  111. for i = 0, num do
  112. game:service("RunService").Stepped:wait(0)
  113. end
  114. end
  115. end
  116. function thread(f)
  117. coroutine.resume(coroutine.create(f))
  118. end
  119. function clerp(a, b, t)
  120. local qa = {
  121. QuaternionFromCFrame(a)
  122. }
  123. local qb = {
  124. QuaternionFromCFrame(b)
  125. }
  126. local ax, ay, az = a.x, a.y, a.z
  127. local bx, by, bz = b.x, b.y, b.z
  128. local _t = 1 - t
  129. return QuaternionToCFrame(_t * ax + t * bx, _t * ay + t * by, _t * az + t * bz, QuaternionSlerp(qa, qb, t))
  130. end
  131. function QuaternionFromCFrame(cf)
  132. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  133. local trace = m00 + m11 + m22
  134. if trace > 0 then
  135. local s = math.sqrt(1 + trace)
  136. local recip = 0.5 / s
  137. return (m21 - m12) * recip, (m02 - m20) * recip, (m10 - m01) * recip, s * 0.5
  138. else
  139. local i = 0
  140. if m00 < m11 then
  141. i = 1
  142. end
  143. if m22 > (i == 0 and m00 or m11) then
  144. i = 2
  145. end
  146. if i == 0 then
  147. local s = math.sqrt(m00 - m11 - m22 + 1)
  148. local recip = 0.5 / s
  149. return 0.5 * s, (m10 + m01) * recip, (m20 + m02) * recip, (m21 - m12) * recip
  150. elseif i == 1 then
  151. local s = math.sqrt(m11 - m22 - m00 + 1)
  152. local recip = 0.5 / s
  153. return (m01 + m10) * recip, 0.5 * s, (m21 + m12) * recip, (m02 - m20) * recip
  154. elseif i == 2 then
  155. local s = math.sqrt(m22 - m00 - m11 + 1)
  156. local recip = 0.5 / s
  157. return (m02 + m20) * recip, (m12 + m21) * recip, 0.5 * s, (m10 - m01) * recip
  158. end
  159. end
  160. end
  161. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  162. local xs, ys, zs = x + x, y + y, z + z
  163. local wx, wy, wz = w * xs, w * ys, w * zs
  164. local xx = x * xs
  165. local xy = x * ys
  166. local xz = x * zs
  167. local yy = y * ys
  168. local yz = y * zs
  169. local zz = z * zs
  170. 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))
  171. end
  172. function QuaternionSlerp(a, b, t)
  173. local cosTheta = a[1] * b[1] + a[2] * b[2] + a[3] * b[3] + a[4] * b[4]
  174. local startInterp, finishInterp
  175. if cosTheta >= 1.0E-4 then
  176. if 1 - cosTheta > 1.0E-4 then
  177. local theta = math.acos(cosTheta)
  178. local invSinTheta = 1 / Sin(theta)
  179. startInterp = Sin((1 - t) * theta) * invSinTheta
  180. finishInterp = Sin(t * theta) * invSinTheta
  181. else
  182. startInterp = 1 - t
  183. finishInterp = t
  184. end
  185. elseif 1 + cosTheta > 1.0E-4 then
  186. local theta = math.acos(-cosTheta)
  187. local invSinTheta = 1 / Sin(theta)
  188. startInterp = Sin((t - 1) * theta) * invSinTheta
  189. finishInterp = Sin(t * theta) * invSinTheta
  190. else
  191. startInterp = t - 1
  192. finishInterp = t
  193. end
  194. 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
  195. end
  196. function rayCast(Position, Direction, Range, Ignore)
  197. return game:service("Workspace"):FindPartOnRay(Ray.new(Position, Direction.unit * (Range or 999.999)), Ignore)
  198. end
  199. local RbxUtility = LoadLibrary("RbxUtility")
  200. local Create = RbxUtility.Create
  201.  
  202. -------------------------------------------------------
  203. --Start Damage Function--
  204. -------------------------------------------------------
  205. function Damage(Part, hit, minim, maxim, knockback, Type, Property, Delay, HitSound, HitPitch)
  206. if hit.Parent == nil then
  207. return
  208. end
  209. local h = hit.Parent:FindFirstChildOfClass("Humanoid")
  210. for _, v in pairs(hit.Parent:children()) do
  211. if v:IsA("Humanoid") then
  212. h = v
  213. end
  214. end
  215. if h ~= nil and hit.Parent.Name ~= char.Name and hit.Parent:FindFirstChild("UpperTorso") ~= nil then
  216.  
  217. hit.Parent:FindFirstChild("Head"):BreakJoints()
  218. end
  219.  
  220. if h ~= nil and hit.Parent.Name ~= char.Name and hit.Parent:FindFirstChild("Torso") ~= nil then
  221. if hit.Parent:findFirstChild("DebounceHit") ~= nil then
  222. if hit.Parent.DebounceHit.Value == true then
  223. return
  224. end
  225. end
  226. if insta == true then
  227. hit.Parent:FindFirstChild("Head"):BreakJoints()
  228. end
  229. local c = Create("ObjectValue"){
  230. Name = "creator",
  231. Value = owner,
  232. Parent = h,
  233. }
  234. game:GetService("Debris"):AddItem(c, .5)
  235. if HitSound ~= nil and HitPitch ~= nil then
  236. CFuncs.Sound.Create(HitSound, hit, 1, HitPitch)
  237. end
  238. local Damage = math.random(minim, maxim)
  239. local blocked = false
  240. local block = hit.Parent:findFirstChild("Block")
  241. if block ~= nil then
  242. if block.className == "IntValue" then
  243. if block.Value > 0 then
  244. blocked = true
  245. block.Value = block.Value - 1
  246. print(block.Value)
  247. end
  248. end
  249. end
  250. if blocked == false then
  251. h.Health = h.Health - Damage
  252. ShowDamage((Part.CFrame * CFrame.new(0, 0, (Part.Size.Z / 2)).p + Vector3.new(0, 1.5, 0)), -Damage, 1.5, tors.BrickColor.Color)
  253. else
  254. h.Health = h.Health - (Damage / 2)
  255. ShowDamage((Part.CFrame * CFrame.new(0, 0, (Part.Size.Z / 2)).p + Vector3.new(0, 1.5, 0)), -Damage, 1.5, tors.BrickColor.Color)
  256. end
  257. if Type == "Knockdown" then
  258. local hum = hit.Parent.Humanoid
  259. hum.PlatformStand = true
  260. coroutine.resume(coroutine.create(function(HHumanoid)
  261. swait(1)
  262. HHumanoid.PlatformStand = false
  263. end), hum)
  264. local angle = (hit.Position - (Property.Position + Vector3.new(0, 0, 0))).unit
  265. local bodvol = Create("BodyVelocity"){
  266. velocity = angle * knockback,
  267. P = 5000,
  268. maxForce = Vector3.new(8e+003, 8e+003, 8e+003),
  269. Parent = hit,
  270. }
  271. local rl = Create("BodyAngularVelocity"){
  272. P = 3000,
  273. maxTorque = Vector3.new(500000, 500000, 500000) * 50000000000000,
  274. angularvelocity = Vector3.new(math.random(-10, 10), math.random(-10, 10), math.random(-10, 10)),
  275. Parent = hit,
  276. }
  277. game:GetService("Debris"):AddItem(bodvol, .5)
  278. game:GetService("Debris"):AddItem(rl, .5)
  279. elseif Type == "Normal" then
  280. local vp = Create("BodyVelocity"){
  281. P = 500,
  282. maxForce = Vector3.new(math.huge, 0, math.huge),
  283. velocity = Property.CFrame.lookVector * knockback + Property.Velocity / 1.05,
  284. }
  285. if knockback > 0 then
  286. vp.Parent = hit.Parent.Torso
  287. end
  288. game:GetService("Debris"):AddItem(vp, .5)
  289. elseif Type == "Up" then
  290. local bodyVelocity = Create("BodyVelocity"){
  291. velocity = Vector3.new(0, 20, 0),
  292. P = 5000,
  293. maxForce = Vector3.new(8e+003, 8e+003, 8e+003),
  294. Parent = hit,
  295. }
  296. game:GetService("Debris"):AddItem(bodyVelocity, .5)
  297. elseif Type == "DarkUp" then
  298. coroutine.resume(coroutine.create(function()
  299. for i = 0, 1, 0.1 do
  300. swait()
  301. Effects.Block.Create(BrickColor.new("Black"), hit.Parent.Torso.CFrame, 5, 5, 5, 1, 1, 1, .08, 1)
  302. end
  303. end))
  304. local bodyVelocity = Create("BodyVelocity"){
  305. velocity = Vector3.new(0, 20, 0),
  306. P = 5000,
  307. maxForce = Vector3.new(8e+003, 8e+003, 8e+003),
  308. Parent = hit,
  309. }
  310. game:GetService("Debris"):AddItem(bodyVelocity, 1)
  311. elseif Type == "Snare" then
  312. local bp = Create("BodyPosition"){
  313. P = 2000,
  314. D = 100,
  315. maxForce = Vector3.new(math.huge, math.huge, math.huge),
  316. position = hit.Parent.Torso.Position,
  317. Parent = hit.Parent.Torso,
  318. }
  319. game:GetService("Debris"):AddItem(bp, 1)
  320. elseif Type == "Freeze" then
  321. local BodPos = Create("BodyPosition"){
  322. P = 50000,
  323. D = 1000,
  324. maxForce = Vector3.new(math.huge, math.huge, math.huge),
  325. position = hit.Parent.Torso.Position,
  326. Parent = hit.Parent.Torso,
  327. }
  328. local BodGy = Create("BodyGyro") {
  329. maxTorque = Vector3.new(4e+005, 4e+005, 4e+005) * math.huge ,
  330. P = 20e+003,
  331. Parent = hit.Parent.Torso,
  332. cframe = hit.Parent.Torso.CFrame,
  333. }
  334. hit.Parent.Torso.Anchored = true
  335. coroutine.resume(coroutine.create(function(Part)
  336. swait(1.5)
  337. Part.Anchored = false
  338. end), hit.Parent.Torso)
  339. game:GetService("Debris"):AddItem(BodPos, 3)
  340. game:GetService("Debris"):AddItem(BodGy, 3)
  341. end
  342. local debounce = Create("BoolValue"){
  343. Name = "DebounceHit",
  344. Parent = hit.Parent,
  345. Value = true,
  346. }
  347. game:GetService("Debris"):AddItem(debounce, Delay)
  348. c = Create("ObjectValue"){
  349. Name = "creator",
  350. Value = Player,
  351. Parent = h,
  352. }
  353. game:GetService("Debris"):AddItem(c, .5)
  354. end
  355. end
  356. -------------------------------------------------------
  357. --End Damage Function--
  358. -------------------------------------------------------
  359.  
  360. -------------------------------------------------------
  361. --Start Design Function--
  362. -------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement