Advertisement
Guest User

Untitled

a guest
May 27th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.33 KB | None | 0 0
  1.  
  2. function Raycast(POSITION, DIRECTION, RANGE, IGNOREDECENDANTS)
  3. return workspace:FindPartOnRay(Ray.new(POSITION, DIRECTION.unit * RANGE), IGNOREDECENDANTS)
  4. end
  5.  
  6. function PositiveAngle(NUMBER)
  7. if NUMBER >= 0 then
  8. NUMBER = 0
  9. end
  10. return NUMBER
  11. end
  12.  
  13. function NegativeAngle(NUMBER)
  14. if NUMBER <= 0 then
  15. NUMBER = 0
  16. end
  17. return NUMBER
  18. end
  19.  
  20. function Swait(NUMBER)
  21. if NUMBER == 0 or NUMBER == nil then
  22. ArtificialHB.Event:wait()
  23. else
  24. for i = 1, NUMBER do
  25. ArtificialHB.Event:wait()
  26. end
  27. end
  28. end
  29.  
  30. function CreateMesh(MESH, PARENT, MESHTYPE, MESHID, TEXTUREID, SCALE, OFFSET)
  31. local NEWMESH = IT(MESH)
  32. if MESH == "SpecialMesh" then
  33. NEWMESH.MeshType = MESHTYPE
  34. if MESHID ~= "nil" and MESHID ~= "" then
  35. NEWMESH.MeshId = "http://www.roblox.com/asset/?id="..MESHID
  36. end
  37. if TEXTUREID ~= "nil" and TEXTUREID ~= "" then
  38. NEWMESH.TextureId = "http://www.roblox.com/asset/?id="..TEXTUREID
  39. end
  40. end
  41. NEWMESH.Offset = OFFSET or VT(0, 0, 0)
  42. NEWMESH.Scale = SCALE
  43. NEWMESH.Parent = PARENT
  44. return NEWMESH
  45. end
  46.  
  47. function CreatePart(FORMFACTOR, PARENT, MATERIAL, REFLECTANCE, TRANSPARENCY, BRICKCOLOR, NAME, SIZE, ANCHOR)
  48. local NEWPART = IT("Part")
  49. NEWPART.formFactor = FORMFACTOR
  50. NEWPART.Reflectance = REFLECTANCE
  51. NEWPART.Transparency = TRANSPARENCY
  52. NEWPART.CanCollide = false
  53. NEWPART.Locked = true
  54. NEWPART.Anchored = true
  55. if ANCHOR == false then
  56. NEWPART.Anchored = false
  57. end
  58. NEWPART.BrickColor = BRICKC(tostring(BRICKCOLOR))
  59. NEWPART.Name = NAME
  60. NEWPART.Size = SIZE
  61. NEWPART.Position = Torso.Position
  62. NEWPART.Material = MATERIAL
  63. NEWPART:BreakJoints()
  64. NEWPART.Parent = PARENT
  65. return NEWPART
  66. end
  67.  
  68. local function weldBetween(a, b)
  69. local weldd = IT("Weld")
  70. weldd.Part0 = a
  71. weldd.Part1 = b
  72. weldd.C0 = CF()
  73. weldd.C1 = b.CFrame:inverse() * a.CFrame
  74. weldd.Parent = a
  75. return weldd
  76. end
  77.  
  78.  
  79. function QuaternionFromCFrame(cf)
  80. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  81. local trace = m00 + m11 + m22
  82. if trace > 0 then
  83. local s = math.sqrt(1 + trace)
  84. local recip = 0.5 / s
  85. return (m21 - m12) * recip, (m02 - m20) * recip, (m10 - m01) * recip, s * 0.5
  86. else
  87. local i = 0
  88. if m11 > m00 then
  89. i = 1
  90. end
  91. if m22 > (i == 0 and m00 or m11) then
  92. i = 2
  93. end
  94. if i == 0 then
  95. local s = math.sqrt(m00 - m11 - m22 + 1)
  96. local recip = 0.5 / s
  97. return 0.5 * s, (m10 + m01) * recip, (m20 + m02) * recip, (m21 - m12) * recip
  98. elseif i == 1 then
  99. local s = math.sqrt(m11 - m22 - m00 + 1)
  100. local recip = 0.5 / s
  101. return (m01 + m10) * recip, 0.5 * s, (m21 + m12) * recip, (m02 - m20) * recip
  102. elseif i == 2 then
  103. local s = math.sqrt(m22 - m00 - m11 + 1)
  104. local recip = 0.5 / s return (m02 + m20) * recip, (m12 + m21) * recip, 0.5 * s, (m10 - m01) * recip
  105. end
  106. end
  107. end
  108.  
  109. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  110. local xs, ys, zs = x + x, y + y, z + z
  111. local wx, wy, wz = w * xs, w * ys, w * zs
  112. local xx = x * xs
  113. local xy = x * ys
  114. local xz = x * zs
  115. local yy = y * ys
  116. local yz = y * zs
  117. local zz = z * zs
  118. 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))
  119. end
  120.  
  121. function QuaternionSlerp(a, b, t)
  122. local cosTheta = a[1] * b[1] + a[2] * b[2] + a[3] * b[3] + a[4] * b[4]
  123. local startInterp, finishInterp;
  124. if cosTheta >= 0.0001 then
  125. if (1 - cosTheta) > 0.0001 then
  126. local theta = ACOS(cosTheta)
  127. local invSinTheta = 1 / SIN(theta)
  128. startInterp = SIN((1 - t) * theta) * invSinTheta
  129. finishInterp = SIN(t * theta) * invSinTheta
  130. else
  131. startInterp = 1 - t
  132. finishInterp = t
  133. end
  134. else
  135. if (1 + cosTheta) > 0.0001 then
  136. local theta = ACOS(-cosTheta)
  137. local invSinTheta = 1 / SIN(theta)
  138. startInterp = SIN((t - 1) * theta) * invSinTheta
  139. finishInterp = SIN(t * theta) * invSinTheta
  140. else
  141. startInterp = t - 1
  142. finishInterp = t
  143. end
  144. end
  145. 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
  146. end
  147.  
  148. function Clerp(a, b, t)
  149. local qa = {QuaternionFromCFrame(a)}
  150. local qb = {QuaternionFromCFrame(b)}
  151. local ax, ay, az = a.x, a.y, a.z
  152. local bx, by, bz = b.x, b.y, b.z
  153. local _t = 1 - t
  154. return QuaternionToCFrame(_t * ax + t * bx, _t * ay + t * by, _t * az + t * bz, QuaternionSlerp(qa, qb, t))
  155. end
  156.  
  157. function CreateFrame(PARENT, TRANSPARENCY, BORDERSIZEPIXEL, POSITION, SIZE, COLOR, BORDERCOLOR, NAME)
  158. local frame = IT("Frame")
  159. frame.BackgroundTransparency = TRANSPARENCY
  160. frame.BorderSizePixel = BORDERSIZEPIXEL
  161. frame.Position = POSITION
  162. frame.Size = SIZE
  163. frame.BackgroundColor3 = COLOR
  164. frame.BorderColor3 = BORDERCOLOR
  165. frame.Name = NAME
  166. frame.Parent = PARENT
  167. return frame
  168. end
  169.  
  170. function CreateLabel(PARENT, TEXT, TEXTCOLOR, TEXTFONTSIZE, TEXTFONT, TRANSPARENCY, BORDERSIZEPIXEL, STROKETRANSPARENCY, NAME)
  171. local label = IT("TextLabel")
  172. label.BackgroundTransparency = 1
  173. label.Size = UD2(1, 0, 1, 0)
  174. label.Position = UD2(0, 0, 0, 0)
  175. label.TextColor3 = TEXTCOLOR
  176. label.TextStrokeTransparency = STROKETRANSPARENCY
  177. label.TextTransparency = TRANSPARENCY
  178. label.FontSize = TEXTFONTSIZE
  179. label.Font = TEXTFONT
  180. label.BorderSizePixel = BORDERSIZEPIXEL
  181. label.TextScaled = false
  182. label.Text = TEXT
  183. label.Name = NAME
  184. label.Parent = PARENT
  185. return label
  186. end
  187.  
  188. function NoOutlines(PART)
  189. PART.TopSurface, PART.BottomSurface, PART.LeftSurface, PART.RightSurface, PART.FrontSurface, PART.BackSurface = 10, 10, 10, 10, 10, 10
  190. end
  191.  
  192. function CreateWeldOrSnapOrMotor(TYPE, PARENT, PART0, PART1, C0, C1)
  193. local NEWWELD = IT(TYPE)
  194. NEWWELD.Part0 = PART0
  195. NEWWELD.Part1 = PART1
  196. NEWWELD.C0 = C0
  197. NEWWELD.C1 = C1
  198. NEWWELD.Parent = PARENT
  199. return NEWWELD
  200. end
  201.  
  202. local S = IT("Sound")
  203. function CreateSound(ID, PARENT, VOLUME, PITCH, DOESLOOP)
  204. local NEWSOUND = nil
  205. coroutine.resume(coroutine.create(function()
  206. NEWSOUND = S:Clone()
  207. NEWSOUND.Parent = PARENT
  208. NEWSOUND.Volume = VOLUME
  209. NEWSOUND.Pitch = PITCH
  210. NEWSOUND.SoundId = "http://www.roblox.com/asset/?id="..ID
  211. NEWSOUND:play()
  212. if DOESLOOP == true then
  213. NEWSOUND.Looped = true
  214. else
  215. repeat wait(1) until NEWSOUND.Playing == false
  216. NEWSOUND:remove()
  217. end
  218. end))
  219. return NEWSOUND
  220. end
  221.  
  222. function CFrameFromTopBack(at, top, back)
  223. local right = top:Cross(back)
  224. return CF(at.x, at.y, at.z, right.x, top.x, back.x, right.y, top.y, back.y, right.z, top.z, back.z)
  225. end
  226.  
  227. --WACKYEFFECT({EffectType = "", Size = VT(1,1,1), Size2 = VT(0,0,0), Transparency = 0, Transparency2 = 1, CFrame = CF(), MoveToPos = nil, RotationX = 0, RotationY = 0, RotationZ = 0, Material = "Plastic", Color = C3(1,1,1), SoundID = nil, SoundPitch = nil, SoundVolume = nil})
  228. function WACKYEFFECT(Table)
  229. local TYPE = (Table.EffectType or "Sphere")
  230. local SIZE = (Table.Size or VT(1,1,1))
  231. local ENDSIZE = (Table.Size2 or VT(0,0,0))
  232. local TRANSPARENCY = (Table.Transparency or 0)
  233. local ENDTRANSPARENCY = (Table.Transparency2 or 1)
  234. local CFRAME = (Table.CFrame or Torso.CFrame)
  235. local MOVEDIRECTION = (Table.MoveToPos or nil)
  236. local ROTATION1 = (Table.RotationX or 0)
  237. local ROTATION2 = (Table.RotationY or 0)
  238. local ROTATION3 = (Table.RotationZ or 0)
  239. local MATERIAL = (Table.Material or "Plastic")
  240. local COLOR = (Table.Color or C3(1,1,1))
  241. local TIME = (Table.Time or 45)
  242. local SOUNDID = (Table.SoundID or nil)
  243. local SOUNDPITCH = (Table.SoundPitch or nil)
  244. local SOUNDVOLUME = (Table.SoundVolume or nil)
  245. coroutine.resume(coroutine.create(function()
  246. local PLAYSSOUND = false
  247. local SOUND = nil
  248. local EFFECT = CreatePart(3, Effects, MATERIAL, 0, TRANSPARENCY, BRICKC("Earth green"), "Effect", VT(1,1,1), true)
  249. if SOUNDID ~= nil and SOUNDPITCH ~= nil and SOUNDVOLUME ~= nil then
  250. PLAYSSOUND = true
  251. SOUND = CreateSound(SOUNDID, EFFECT, SOUNDVOLUME, SOUNDPITCH, false)
  252. end
  253. EFFECT.Color = COLOR
  254. local MSH = nil
  255. if TYPE == "Sphere" then
  256. MSH = CreateMesh("SpecialMesh", EFFECT, "Sphere", "", "", SIZE, VT(0,0,0))
  257. elseif TYPE == "Block" then
  258. MSH = IT("BlockMesh",EFFECT)
  259. MSH.Scale = VT(SIZE.X,SIZE.X,SIZE.X)
  260. elseif TYPE == "Wave" then
  261. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "20329976", "", SIZE, VT(0,0,-SIZE.X/8))
  262. elseif TYPE == "Ring" then
  263. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "559831844", "", VT(SIZE.X,SIZE.X,0.1), VT(0,0,0))
  264. elseif TYPE == "Slash" then
  265. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "662586858", "", VT(SIZE.X/10,0,SIZE.X/10), VT(0,0,0))
  266. elseif TYPE == "Round Slash" then
  267. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "662585058", "", VT(SIZE.X/10,0,SIZE.X/10), VT(0,0,0))
  268. elseif TYPE == "Swirl" then
  269. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "1051557", "", SIZE, VT(0,0,0))
  270. elseif TYPE == "Skull" then
  271. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "4770583", "", SIZE, VT(0,0,0))
  272. elseif TYPE == "Crystal" then
  273. MSH = CreateMesh("SpecialMesh", EFFECT, "FileMesh", "9756362", "", SIZE, VT(0,0,0))
  274. end
  275. if MSH ~= nil then
  276. local MOVESPEED = nil
  277. if MOVEDIRECTION ~= nil then
  278. MOVESPEED = (CFRAME.p - MOVEDIRECTION).Magnitude/TIME
  279. end
  280. local GROWTH = SIZE - ENDSIZE
  281. local TRANS = TRANSPARENCY - ENDTRANSPARENCY
  282. if TYPE == "Block" then
  283. EFFECT.CFrame = CFRAME*ANGLES(RAD(MRANDOM(0,360)),RAD(MRANDOM(0,360)),RAD(MRANDOM(0,360)))
  284. else
  285. EFFECT.CFrame = CFRAME
  286. end
  287. for LOOP = 1, TIME+1 do
  288. Swait()
  289. MSH.Scale = MSH.Scale - GROWTH/TIME
  290. if TYPE == "Wave" then
  291. MSH.Offset = VT(0,0,-MSH.Scale.X/8)
  292. end
  293. EFFECT.Transparency = EFFECT.Transparency - TRANS/TIME
  294. if TYPE == "Block" then
  295. EFFECT.CFrame = CFRAME*ANGLES(RAD(MRANDOM(0,360)),RAD(MRANDOM(0,360)),RAD(MRANDOM(0,360)))
  296. else
  297. EFFECT.CFrame = EFFECT.CFrame*ANGLES(RAD(ROTATION1),RAD(ROTATION2),RAD(ROTATION3))
  298. end
  299. if MOVEDIRECTION ~= nil then
  300. local ORI = EFFECT.Orientation
  301. EFFECT.CFrame = CF(EFFECT.Position,MOVEDIRECTION)*CF(0,0,-MOVESPEED)
  302. EFFECT.Orientation = ORI
  303. end
  304. end
  305. if PLAYSSOUND == false then
  306. EFFECT:remove()
  307. else
  308. SOUND.Stopped:Connect(function()
  309. EFFECT:remove()
  310. end)
  311. end
  312. else
  313. if PLAYSSOUND == false then
  314. EFFECT:remove()
  315. else
  316. repeat Swait() until SOUND.Playing == false
  317. EFFECT:remove()
  318. end
  319. end
  320. end))
  321. end
  322.  
  323. function MakeForm(PART,TYPE)
  324. if TYPE == "Cyl" then
  325. local MSH = IT("CylinderMesh",PART)
  326. elseif TYPE == "Ball" then
  327. local MSH = IT("SpecialMesh",PART)
  328. MSH.MeshType = "Sphere"
  329. elseif TYPE == "Wedge" then
  330. local MSH = IT("SpecialMesh",PART)
  331. MSH.MeshType = "Wedge"
  332. end
  333. end
  334.  
  335. Debris = game:GetService("Debris")
  336.  
  337. function CastProperRay(StartPos, EndPos, Distance, Ignore)
  338. local DIRECTION = CF(StartPos,EndPos).lookVector
  339. return Raycast(StartPos, DIRECTION, Distance, Ignore)
  340. end
  341.  
  342. function turnto(position)
  343. RootPart.CFrame=CFrame.new(RootPart.CFrame.p,VT(position.X,RootPart.Position.Y,position.Z)) * CFrame.new(0, 0, 0)
  344. end
  345.  
  346. function SpawnTrail(FROM,TO,BIG)
  347. local TRAIL = CreatePart(3, Effects, "Plastic", 0, 0.5, "White", "Trail", VT(0,0,0))
  348. MakeForm(TRAIL,"Cyl")
  349. local DIST = (FROM - TO).Magnitude
  350. if BIG == true then
  351. TRAIL.Size = VT(0.5,DIST,0.5)
  352. else
  353. TRAIL.Size = VT(0.25,DIST,0.25)
  354. end
  355. TRAIL.CFrame = CF(FROM, TO) * CF(0, 0, -DIST/2) * ANGLES(RAD(90),RAD(0),RAD(0))
  356. coroutine.resume(coroutine.create(function()
  357. for i = 1, 5 do
  358. Swait()
  359. TRAIL.Transparency = TRAIL.Transparency + 0.1
  360. end
  361. TRAIL:remove()
  362. end))
  363. end
  364.  
  365. local asd = Instance.new("ParticleEmitter")
  366. asd.Color = ColorSequence.new(Color3.new(0.5, 0, 0), Color3.new(.3, 0, 0))
  367. asd.LightEmission = .1
  368. asd.Texture = "http://www.roblox.com/asset/?ID=306562065"
  369. aaa = NumberSequence.new({NumberSequenceKeypoint.new(0, 0.6),NumberSequenceKeypoint.new(1, 2)})
  370. bbb = NumberSequence.new({NumberSequenceKeypoint.new(0, 1),NumberSequenceKeypoint.new(0.0636, 0), NumberSequenceKeypoint.new(1, 1)})
  371. asd.Transparency = bbb
  372. asd.Size = aaa
  373. asd.ZOffset = .9
  374. asd.Acceleration = Vector3.new(0, -15, 0)
  375. asd.LockedToPart = false
  376. asd.EmissionDirection = "Back"
  377. asd.Lifetime = NumberRange.new(1, 2)
  378. asd.Rotation = NumberRange.new(-100, 100)
  379. asd.RotSpeed = NumberRange.new(-100, 100)
  380. asd.Speed = NumberRange.new(10)
  381. asd.Enabled = false
  382. asd.VelocitySpread = 999
  383.  
  384. function getbloody(victim,amount)
  385. local PART = CreatePart(3, Effects, "Metal", 0, 1, "Mid gray", "Blood", victim.Size)
  386. PART.CFrame = victim.CFrame
  387. local HITPLAYERSOUNDS = {"356551938","264486467"}
  388. Debris:AddItem(PART,5)
  389. CreateSound(HITPLAYERSOUNDS[MRANDOM(1, #HITPLAYERSOUNDS)], PART, 1, (math.random(8,12)/10))
  390. CreateSound(HITPLAYERSOUNDS[MRANDOM(1, #HITPLAYERSOUNDS)], PART, 1, (math.random(8,12)/10))
  391. CreateSound(HITPLAYERSOUNDS[MRANDOM(1, #HITPLAYERSOUNDS)], PART, 1, (math.random(8,12)/10))
  392. local prtcl = asd:Clone()
  393. prtcl.Parent = PART
  394. prtcl:Emit(amount*10)
  395. end
  396.  
  397. local Particle = IT("ParticleEmitter",nil)
  398. Particle.Enabled = false
  399. Particle.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0,1),NumberSequenceKeypoint.new(0.3,0.95),NumberSequenceKeypoint.new(1,1)})
  400. Particle.LightEmission = 0.5
  401. Particle.Rate = 150
  402. Particle.ZOffset = 1
  403. Particle.Rotation = NumberRange.new(-180, 180)
  404. Particle.RotSpeed = NumberRange.new(-180, 180)
  405. Particle.Texture = "http://www.roblox.com/asset/?id=306562065"
  406. Particle.Color = ColorSequence.new(C3(113/255,148/255,90/255),C3(113/255,148/255,90/255))
  407.  
  408. --ParticleEmitter({Speed = 5, Drag = 0, Size1 = 1, Size2 = 5, Lifetime1 = 1, Lifetime2 = 1.5, Parent = Torso, Emit = 100, Offset = 360, Enabled = false})
  409. function ParticleEmitter(Table)
  410. local PRTCL = Particle:Clone()
  411. local Speed = Table.Speed or 5
  412. local Drag = Table.Drag or 0
  413. local Size1 = Table.Size1 or 1
  414. local Size2 = Table.Size2 or 5
  415. local Lifetime1 = Table.Lifetime1 or 1
  416. local Lifetime2 = Table.Lifetime2 or 1.5
  417. local Parent = Table.Parent or Torso
  418. local Emit = Table.Emit or 100
  419. local Offset = Table.Offset or 360
  420. local Acel = Table.Acel or VT(0,0,0)
  421. local Enabled = Table.Enabled or false
  422. PRTCL.Parent = Parent
  423. PRTCL.Size = NumberSequence.new(Size1,Size2)
  424. PRTCL.Lifetime = NumberRange.new(Lifetime1,Lifetime2)
  425. PRTCL.Speed = NumberRange.new(Speed)
  426. PRTCL.VelocitySpread = Offset
  427. PRTCL.Drag = Drag
  428. PRTCL.Acceleration = Acel
  429. if Enabled == false then
  430. PRTCL:Emit(Emit)
  431. Debris:AddItem(PRTCL,Lifetime2)
  432. else
  433. PRTCL.Enabled = true
  434. end
  435. return PRTCL
  436. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement