Advertisement
mohamedbh

ROBLOX (Dragon) Script

Jun 19th, 2015
5,365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.23 KB | None | 0 0
  1. --when you see YOURDRAGONNAME that means type your dragon name and when you see YOURNAMEHERE that mean you have to put your name--
  2. MainColor = "Bright blue"
  3.  
  4. Name = "YOURDRAGONNAME."
  5.  
  6.  
  7.  
  8. Plrs = game:GetService("Players")
  9.  
  10.  
  11.  
  12. me = Plrs.YOURNAMEHERE
  13.  
  14. char = me.Character
  15.  
  16. Modelname = "xDragon"
  17.  
  18. PetName = "xDragon"
  19.  
  20. Toolname = "Dragon"
  21.  
  22. Surfaces = {"FrontSurface", "BackSurface", "TopSurface", "BottomSurface", "LeftSurface", "RightSurface"}
  23.  
  24. necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  25.  
  26. selected = false
  27.  
  28. Hurt = false
  29.  
  30. Deb = true
  31.  
  32. Able = true
  33.  
  34. Prop = {Damage = 30}
  35.  
  36.  
  37.  
  38. ToolIcon = ""
  39.  
  40. MouseIc = ""
  41.  
  42. MouseDo = ""
  43.  
  44.  
  45.  
  46. Add = {
  47.  
  48. Sphere = function(P)
  49.  
  50. local m = Instance.new("SpecialMesh",P)
  51.  
  52. m.MeshType = "Sphere"
  53.  
  54. return m
  55.  
  56. end,
  57.  
  58. BF = function(P)
  59.  
  60. local bf = Instance.new("BodyForce",P)
  61.  
  62. bf.force = Vector3.new(0, P:GetMass()*187, 0)
  63.  
  64. return bf
  65.  
  66. end,
  67.  
  68. BP = function(P)
  69.  
  70. local bp = Instance.new("BodyPosition",P)
  71.  
  72. bp.maxForce = Vector3.new(math.huge, 0, math.huge)
  73.  
  74. bp.P = 14000
  75.  
  76. return bp
  77.  
  78. end,
  79.  
  80. BG = function(P)
  81.  
  82. local bg = Instance.new("BodyGyro",P)
  83.  
  84. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  85.  
  86. bg.P = 14000
  87.  
  88. return bg
  89.  
  90. end,
  91.  
  92. Mesh = function(P, ID, x, y, z)
  93.  
  94. local m = Instance.new("SpecialMesh")
  95.  
  96. m.MeshId = ID
  97.  
  98. m.Scale = Vector3.new(x, y, z)
  99.  
  100. m.Parent = P
  101.  
  102. return m
  103.  
  104. end,
  105.  
  106. Sound = function(P, ID, vol, pitch)
  107.  
  108. local s = Instance.new("Sound")
  109.  
  110. s.SoundId = ID
  111.  
  112. s.Volume = vol
  113.  
  114. s.Pitch = pitch
  115.  
  116. s.Parent = P
  117.  
  118. return s
  119.  
  120. end
  121.  
  122. }
  123.  
  124.  
  125.  
  126. function find(tab, arg)
  127.  
  128. local ah = nil
  129.  
  130. for i,v in pairs(tab) do
  131.  
  132. if v == arg then
  133.  
  134. ah = v
  135.  
  136. end
  137.  
  138. end
  139.  
  140. return ah
  141.  
  142. end
  143.  
  144.  
  145.  
  146. function getAllParts(from)
  147.  
  148. local t = {}
  149.  
  150. function getParts(where)
  151.  
  152. for i, v in pairs(where:children()) do
  153.  
  154. if v:IsA("BasePart") then
  155.  
  156. if v.Parent ~= char and v.Parent.Parent ~= char then
  157.  
  158. table.insert(t, v)
  159.  
  160. end
  161.  
  162. end
  163.  
  164. getParts(v)
  165.  
  166. end
  167.  
  168. end
  169.  
  170. getParts(workspace)
  171.  
  172. return t
  173.  
  174. end
  175.  
  176.  
  177.  
  178. function RayCast(pos1, pos2, maxDist, forward)
  179.  
  180. local list = getAllParts(workspace)
  181.  
  182. local pos0 = pos1
  183.  
  184. for dist = 1, maxDist, forward do
  185.  
  186. pos0 = (CFrame.new(pos1, pos2) * CFrame.new(0, 0, -dist)).p
  187.  
  188. for _, v in pairs(list) do
  189.  
  190. local pos3 = v.CFrame:pointToObjectSpace(pos0)
  191.  
  192. local s = v.Size
  193.  
  194. if pos3.x > -(s.x/2) and pos3.x < (s.x/2) and pos3.y > -(s.y/2) and pos3.y < (s.y/2) and pos3.z > -(s.z/2) and pos3.x < (s.z/2) and v.CanCollide == true then
  195.  
  196. return pos0, v
  197.  
  198. end
  199.  
  200. end
  201.  
  202. end
  203.  
  204. return pos0, nil
  205.  
  206. end
  207.  
  208.  
  209.  
  210. function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
  211.  
  212. local p = Instance.new("Part")
  213.  
  214. p.formFactor = "Custom"
  215.  
  216. p.Anchored = Anchor
  217.  
  218. p.CanCollide = Collide
  219.  
  220. p.Transparency = Tran
  221.  
  222. p.Reflectance = Ref
  223.  
  224. p.BrickColor = BrickColor.new(Color)
  225.  
  226. for _, Surf in pairs(Surfaces) do
  227.  
  228. p[Surf] = "Smooth"
  229.  
  230. end
  231.  
  232. p.Size = Vector3.new(X, Y, Z)
  233.  
  234. if Break then
  235.  
  236. p:BreakJoints()
  237.  
  238. else p:MakeJoints() end
  239.  
  240. p.Parent = Parent
  241.  
  242. return p
  243.  
  244. end
  245.  
  246.  
  247.  
  248. function Weld(p0, p1, x, y, z, a, b, c)
  249.  
  250. local w = Instance.new("Weld")
  251.  
  252. w.Parent = p0
  253.  
  254. w.Part0 = p0
  255.  
  256. w.Part1 = p1
  257.  
  258. w.C1 = CFrame.new(x,y,z) * CFrame.Angles(a,b,c)
  259.  
  260. return w
  261.  
  262. end
  263.  
  264.  
  265.  
  266. function ComputePos(pos1, pos2)
  267.  
  268. local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
  269.  
  270. return CFrame.new(pos1, pos3)
  271.  
  272. end
  273.  
  274.  
  275.  
  276. function getHumanoid(c)
  277.  
  278. local h = nil
  279.  
  280. for i,v in pairs(c:children()) do
  281.  
  282. if v:IsA("Humanoid") and c ~= char then
  283.  
  284. if v.Health > 0 then
  285.  
  286. h = v
  287.  
  288. end
  289.  
  290. end
  291.  
  292. end
  293.  
  294. return h
  295.  
  296. end
  297.  
  298.  
  299.  
  300. for i,v in pairs(char:children()) do
  301.  
  302. if v.Name == Modelname or v.Name == PetName then
  303.  
  304. v:remove()
  305.  
  306. end
  307.  
  308. end
  309.  
  310.  
  311.  
  312. torso = char.Torso
  313.  
  314. neck = torso.Neck
  315.  
  316. hum = char.Humanoid
  317.  
  318. Rarm = char["Right Arm"]
  319.  
  320. Larm = char["Left Arm"]
  321.  
  322. Rleg = char["Right Leg"]
  323.  
  324. Lleg = char["Left Leg"]
  325.  
  326.  
  327.  
  328. hc = Instance.new("Humanoid")
  329.  
  330. hc.Health = 0
  331.  
  332. hc.MaxHealth = 0
  333.  
  334.  
  335.  
  336. slash = Add.Sound(nil, "rbxasset://sounds//swordslash.wav", 0.9, 0.8)
  337.  
  338. hitsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2801263", 0.7, 0.6)
  339.  
  340. charge = Add.Sound(nil, "http://www.roblox.com/asset/?id=2101137", 0.8, 0.65)
  341.  
  342. boom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2691586", 0.8, 0.3)
  343.  
  344. smashsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2692806", 0.8, 0.35)
  345.  
  346. boomboom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2760979", 1, 0.18)
  347.  
  348.  
  349.  
  350. function PlaySound(sound, pitch, vol)
  351.  
  352. local s = sound:clone()
  353.  
  354. if pitch ~= nil then
  355.  
  356. if tonumber(pitch) then
  357.  
  358. s.Pitch = tonumber(pitch)
  359.  
  360. end
  361.  
  362. end
  363.  
  364. if vol ~= nil then
  365.  
  366. if tonumber(vol) then
  367.  
  368. s.Volume = tonumber(vol)
  369.  
  370. end
  371.  
  372. end
  373.  
  374. s.Parent = torso
  375.  
  376. s.PlayOnRemove = true
  377.  
  378. coroutine.resume(coroutine.create(function()
  379.  
  380. wait()
  381.  
  382. s:remove()
  383.  
  384. end))
  385.  
  386. end
  387.  
  388.  
  389.  
  390. Mo = Instance.new("Model")
  391.  
  392. Mo.Name = Modelname
  393.  
  394.  
  395.  
  396. RABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  397.  
  398. LABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  399.  
  400. RLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  401.  
  402. LLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  403.  
  404.  
  405.  
  406. RABW = Weld(torso, RABrick, -1.5, -0.5, 0, 0, 0, 0)
  407.  
  408. LABW = Weld(torso, LABrick, 1.5, -0.5, 0, 0, 0, 0)
  409.  
  410. RLBW = Weld(torso, RLBrick, -0.5, 1.2, 0, 0, 0, 0)
  411.  
  412. LLBW = Weld(torso, LLBrick, 0.5, 1.2, 0, 0, 0, 0)
  413.  
  414.  
  415.  
  416. RAW = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0)
  417.  
  418. LAW = Weld(LABrick, nil, 0, 0.5, 0, 0, 0, 0)
  419.  
  420. RLW = Weld(RLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  421.  
  422. LLW = Weld(LLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  423.  
  424.  
  425.  
  426. HB = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  427.  
  428. HBW = Weld(Rarm, HB, 0, 1, 0, 0, 0, 0)
  429.  
  430. HW = Weld(HB, nil, 0, -1.3, 0, math.pi/2, 0, 0)
  431.  
  432.  
  433.  
  434. TH = Weld(torso, nil, -0.8, 0.4, -0.4, 0, math.pi/2, math.rad(80))
  435.  
  436.  
  437.  
  438. RAWStand, LAWStand, RLWStand, LLWStand, HWStand = nil
  439.  
  440.  
  441.  
  442. --handle = Part(Mo, false, false, 0, 0, GuitarColour, 0.6, 1.5, 1.5, true)
  443.  
  444.  
  445.  
  446. Pet = Instance.new("Model")
  447.  
  448. Pet.Name = PetName
  449.  
  450.  
  451.  
  452. petbody = Part(Pet, false, true, 0, 0, MainColor, 3, 2.6, 6, true)
  453.  
  454. Add.Sphere(petbody)
  455.  
  456. petbody.CFrame = torso.CFrame * CFrame.new(4, 0, 0)
  457.  
  458.  
  459.  
  460. bodytrim = Part(Pet, false, true, 0, 0, "Cool yellow", 2.7, 2.4, 5.4, true)
  461.  
  462. Add.Sphere(bodytrim)
  463.  
  464. Weld(petbody, bodytrim, 0, 0.25, 0, 0, 0, 0)
  465.  
  466.  
  467.  
  468. neckplace = Part(Pet, false, false, 0, 0, "Cool yellow", 0.1, 0.1, 0.1, true)
  469.  
  470. Weld(petbody, neckplace, 0, -0.2, 2.6, 0, 0, 0)
  471.  
  472.  
  473.  
  474. Mo.Parent = char
  475.  
  476. Pet.Parent = char
  477.  
  478. TH.Part1 = handle
  479.  
  480.  
  481.  
  482. if script.Parent.className ~= "HopperBin" then
  483.  
  484. h = Instance.new("HopperBin",me.Backpack)
  485.  
  486. h.Name = Toolname
  487.  
  488. h.TextureId = ToolIcon
  489.  
  490. script.Parent = h
  491.  
  492. end
  493.  
  494.  
  495.  
  496. bin = script.Parent
  497.  
  498.  
  499.  
  500. function detach(bool)
  501.  
  502. LLW.C0 = CFrame.new(0, 0, 0)
  503.  
  504. RLW.C0 = CFrame.new(0, 0, 0)
  505.  
  506. LAW.C0 = CFrame.new(0,0,0)
  507.  
  508. RAW.C0 = CFrame.new(0, 0, 0)
  509.  
  510. if bool then
  511.  
  512. LLW.Part1 = nil
  513.  
  514. RLW.Part1 = nil
  515.  
  516. RAW.Part1 = nil
  517.  
  518. LAW.Part1 = nil
  519.  
  520. end
  521.  
  522. end
  523.  
  524.  
  525.  
  526. function attach()
  527.  
  528. RAW.Part1 = Rarm
  529.  
  530. LAW.Part1 = Larm
  531.  
  532. RLW.Part1 = Rleg
  533.  
  534. LLW.Part1 = Lleg
  535.  
  536. end
  537.  
  538.  
  539.  
  540. function normal()
  541.  
  542. neck.C0 = NeckStand
  543.  
  544. RAW.C0 = RAWStand
  545.  
  546. LAW.C0 = LAWStand
  547.  
  548. RLW.C0 = RLWStand
  549.  
  550. LLW.C0 = LLWStand
  551.  
  552. RAW.C1 = CFrame.new(0, 0.5, 0)
  553.  
  554. LAW.C1 = CFrame.new(0, 0.5, 0)
  555.  
  556. RLW.C1 = CFrame.new(0, 0.8, 0)
  557.  
  558. LLW.C1 = CFrame.new(0, 0.8, 0)
  559.  
  560. HW.C0 = HWStand
  561.  
  562. end
  563.  
  564.  
  565.  
  566. function idleanim()
  567.  
  568. attach()
  569.  
  570. for i = 0, 1, 0.03 do
  571.  
  572. RAW.C0 = RAWStand * CFrame.Angles(0, 0, 0)
  573.  
  574. LAW.C0 = LAWStand * CFrame.Angles(0, 0, 0)
  575.  
  576. RLW.C0 = RLWStand * CFrame.Angles(0, 0, 0)
  577.  
  578. LLW.C0 = LLWStand * CFrame.Angles(0, 0, 0)
  579.  
  580. neck.C0 = NeckStand * CFrame.Angles(0, 0, 0)
  581.  
  582. if selected == false or torso.Velocity.magnitude > 2 or Able == false then break end
  583.  
  584. wait()
  585.  
  586. end
  587.  
  588. wait()
  589.  
  590. for i = 1, 0, -0.02 do
  591.  
  592. RAW.C0 = RAWStand * CFrame.Angles(0, 0, 0)
  593.  
  594. LAW.C0 = LAWStand * CFrame.Angles(0, 0, 0)
  595.  
  596. RLW.C0 = RLWStand * CFrame.Angles(0, 0, 0)
  597.  
  598. LLW.C0 = LLWStand * CFrame.Angles(0, 0, 0)
  599.  
  600. neck.C0 = NeckStand * CFrame.Angles(0, 0, 0)
  601.  
  602. if selected == false or torso.Velocity.magnitude > 2 or Able == false then break end
  603.  
  604. wait()
  605.  
  606. end
  607.  
  608. normal()
  609.  
  610. end
  611.  
  612.  
  613.  
  614. function runanim()
  615.  
  616. RLW.Part1 = nil
  617.  
  618. LLW.Part1 = nil
  619.  
  620. end
  621.  
  622.  
  623.  
  624. coroutine.resume(coroutine.create(function()
  625.  
  626. while true do
  627.  
  628. wait()
  629.  
  630. if selected and Able == true then
  631.  
  632. if torso.Velocity.magnitude < 2 then
  633.  
  634. --idleanim()
  635.  
  636. wait()
  637.  
  638. else
  639.  
  640. --runanim()
  641.  
  642. wait()
  643.  
  644. end
  645.  
  646. end
  647.  
  648. end
  649.  
  650. end))
  651.  
  652.  
  653.  
  654. function selectanim()
  655.  
  656. attach()
  657.  
  658. if RAWStand == nil then
  659.  
  660. RAWStand = RAW.C0
  661.  
  662. LAWStand = LAW.C0
  663.  
  664. RLWStand = RLW.C0
  665.  
  666. LLWStand = LLW.C0
  667.  
  668. HWStand = HW.C0
  669.  
  670. end
  671.  
  672. normal()
  673.  
  674. end
  675.  
  676.  
  677.  
  678. function deselanim()
  679.  
  680. neck.C0 = necko
  681.  
  682. detach(true)
  683.  
  684. end
  685.  
  686.  
  687.  
  688. function select(mouse)
  689.  
  690. selectanim()
  691.  
  692. selected = true
  693.  
  694. mouse.KeyDown:connect(function(key)
  695.  
  696. key = key:lower()
  697.  
  698. end)
  699.  
  700. mouse.Button1Down:connect(function()
  701.  
  702. end)
  703.  
  704. end
  705.  
  706.  
  707.  
  708. function deselect(mouse)
  709.  
  710. selected = false
  711.  
  712. deselanim()
  713.  
  714. end
  715.  
  716.  
  717.  
  718. bin.Selected:connect(select)
  719.  
  720. bin.Deselected:connect(deselect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement