Advertisement
KHSora455

Pet Snake

Feb 25th, 2015
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.61 KB | None | 0 0
  1. sb/local h = Instance.new("HopperBin")
  2. h.Name = "Snake"
  3. local s = Instance.new("Script")
  4. s.Parent = h
  5. s.Name = "Script"
  6. s.Source = [[
  7. local bin = script.Parent
  8. mode = "stay"
  9. length = 3
  10. away = 2
  11. gap = 0
  12. local part1 = Instance.new("Seat")
  13. part1.BrickColor = BrickColor.new("Really red")
  14. part1.Transparency = .5
  15. part1.Reflectance = .5
  16. part1.TopSurface = 0
  17. part1.BottomSurface = 0
  18. part1.Locked = true
  19. part1.Size = Vector3.new(3,1,length)
  20. part1.Anchored = true
  21. part1.Shape = 1
  22. part1.CanCollide = true
  23. part1.Parent = nil
  24. part1.Name = "Part1"
  25.  
  26. local part2 = part1:Clone()
  27. part2.Parent = nil
  28. part2.Name = "Part2"
  29. part2.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  30.  
  31. local part3 = part2:Clone()
  32. part3.Parent = nil
  33. part3.Name = "Part3"
  34. part3.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  35.  
  36. local part4 = part3:Clone()
  37. part4.Parent = nil
  38. part4.Name = "Part4"
  39. part4.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  40.  
  41. local part5 = part4:Clone()
  42. part5.Parent = nil
  43. part5.Name = "Part5"
  44. part5.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  45.  
  46. local part6 = part5:Clone()
  47. part6.Parent = nil
  48. part6.Name = "Part6"
  49. part6.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  50.  
  51. local part7 = part6:Clone()
  52. part7.Parent = nil
  53. part7.Name = "Part7"
  54. part7.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  55.  
  56. local part8 = part7:Clone()
  57. part8.Parent = nil
  58. part8.Name = "Part8"
  59. part8.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  60.  
  61. local part9 = part8:Clone()
  62. part9.Parent = nil
  63. part9.Name = "Part9"
  64. part9.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  65.  
  66. local part10 = part9:Clone()
  67. part10.Parent = nil
  68. part10.Name = "Part10"
  69. part10.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  70.  
  71. local part11 = part10:Clone()
  72. part11.Parent = nil
  73. part11.Name = "Part11"
  74. part11.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  75.  
  76. local part12 = part11:Clone()
  77. part12.Parent = nil
  78. part12.Name = "Part12"
  79. part12.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  80.  
  81. local part13 = part12:Clone()
  82. part13.Parent = nil
  83. part13.Name = "Part13"
  84. part13.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  85.  
  86. local part14 = part13:Clone()
  87. part14.Parent = nil
  88. part14.Name = "Part14"
  89. part14.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  90.  
  91. local part15 = part14:Clone()
  92. part15.Parent = nil
  93. part15.Name = "Part15"
  94. part15.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  95.  
  96. local part16 = part15:Clone()
  97. part16.Parent = nil
  98. part16.Name = "Part16"
  99. part16.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  100.  
  101. local part17 = part16:Clone()
  102. part17.Parent = nil
  103. part17.Name = "Part17"
  104. part17.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  105.  
  106. local part18 = part17:Clone()
  107. part18.Parent = nil
  108. part18.Name = "Part18"
  109. part18CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  110.  
  111. local part19 = part18:Clone()
  112. part19.Parent = nil
  113. part19.Name = "Part19"
  114. part19.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  115.  
  116. local part20 = part19:Clone()
  117. part20.Parent = nil
  118. part20.Name = "Part20"
  119. part20.CFrame = CFrame.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
  120.  
  121. function resize(x, y, z)
  122. length = z
  123. part1.Size = Vector3.new(x, y, z)
  124. part2.Size = Vector3.new(x, y, z)
  125. part3.Size = Vector3.new(x, y, z)
  126. part4.Size = Vector3.new(x, y, z)
  127. part5.Size = Vector3.new(x, y, z)
  128. part6.Size = Vector3.new(x, y, z)
  129. part7.Size = Vector3.new(x, y, z)
  130. part8.Size = Vector3.new(x, y, z)
  131. part9.Size = Vector3.new(x, y, z)
  132. part10.Size = Vector3.new(x, y, z)
  133. part11.Size = Vector3.new(x, y, z)
  134. part12.Size = Vector3.new(x, y, z)
  135. part13.Size = Vector3.new(x, y, z)
  136. part14.Size = Vector3.new(x, y, z)
  137. part15.Size = Vector3.new(x, y, z)
  138. part16.Size = Vector3.new(x, y, z)
  139. part17.Size = Vector3.new(x, y, z)
  140. part18.Size = Vector3.new(x, y, z)
  141. part19.Size = Vector3.new(x, y, z)
  142. part20.Size = Vector3.new(x, y, z)
  143. end
  144.  
  145. function color(col)
  146. part1.BrickColor = col
  147. part2.BrickColor = col
  148. part3.BrickColor = col
  149. part4.BrickColor = col
  150. part5.BrickColor = col
  151. part6.BrickColor = col
  152. part7.BrickColor = col
  153. part8.BrickColor = col
  154. part9.BrickColor = col
  155. part10.BrickColor = col
  156. part11.BrickColor = col
  157. part12.BrickColor = col
  158. part13.BrickColor = col
  159. part14.BrickColor = col
  160. part15.BrickColor = col
  161. part16.BrickColor = col
  162. part17.BrickColor = col
  163. part18.BrickColor = col
  164. part19.BrickColor = col
  165. part20.BrickColor = col
  166. end
  167.  
  168. function reflectance(refle)
  169. part1.Reflectance = refle
  170. part2.Reflectance = refle
  171. part3.Reflectance = refle
  172. part4.Reflectance = refle
  173. part5.Reflectance = refle
  174. part6.Reflectance = refle
  175. part7.Reflectance = refle
  176. part8.Reflectance = refle
  177. part9.Reflectance = refle
  178. part10.Reflectance = refle
  179. part11.Reflectance = refle
  180. part12.Reflectance = refle
  181. part13.Reflectance = refle
  182. part14.Reflectance = refle
  183. part15.Reflectance = refle
  184. part16.Reflectance = refle
  185. part17.Reflectance = refle
  186. part18.Reflectance = refle
  187. part19.Reflectance = refle
  188. part20.Reflectance = refle
  189. end
  190.  
  191. function transparency(trans)
  192. part1.Transparency = trans
  193. part2.Transparency = trans
  194. part3.Transparency = trans
  195. part4.Transparency = trans
  196. part5.Transparency = trans
  197. part6.Transparency = trans
  198. part7.Transparency = trans
  199. part8.Transparency = trans
  200. part9.Transparency = trans
  201. part10.Transparency = trans
  202. part11.Transparency = trans
  203. part12.Transparency = trans
  204. part13.Transparency = trans
  205. part14.Transparency = trans
  206. part15.Transparency = trans
  207. part16.Transparency = trans
  208. part17.Transparency = trans
  209. part18.Transparency = trans
  210. part19.Transparency = trans
  211. part20.Transparency = trans
  212. end
  213. function shape(sha)
  214. part1.Shape = sha
  215. part2.Shape = sha
  216. part3.Shape = sha
  217. part4.Shape = sha
  218. part5.Shape = sha
  219. part6.Shape = sha
  220. part7.Shape = sha
  221. part8.Shape = sha
  222. part9.Shape = sha
  223. part10.Shape = sha
  224. part11.Shape = sha
  225. part12.Shape = sha
  226. part13.Shape = sha
  227. part14.Shape = sha
  228. part15.Shape = sha
  229. part16.Shape = sha
  230. part17.Shape = sha
  231. part18.Shape = sha
  232. part19.Shape = sha
  233. part20.Shape = sha
  234. end
  235.  
  236. distance = length/2
  237. speed = 5
  238. local main = part20:Clone()
  239. main.Shape = 0
  240. main.Size = Vector3.new(5, 5, 5)
  241. main.Transparency = 0.5
  242. main.Anchored = true
  243. main.BrickColor = BrickColor.Red()
  244. main.TopSurface = 0
  245. main.BottomSurface = 0
  246. function onButton1Down(mouse)
  247. local player = game.Players.LocalPlayer
  248. if player == nil then return end
  249. main.Parent = me
  250. part1.Parent = me
  251. part2.Parent = me
  252. part3.Parent = me
  253. part4.Parent = me
  254. part5.Parent = me
  255. part6.Parent = me
  256. part7.Parent = me
  257. part8.Parent = me
  258. part9.Parent = me
  259. part10.Parent = me
  260. part11.Parent = me
  261. part12.Parent = me
  262. part13.Parent = me
  263. part14.Parent = me
  264. part15.Parent = me
  265. part16.Parent = me
  266. part17.Parent = me
  267. part18.Parent = me
  268. part19.Parent = me
  269. part20.Parent = me
  270.  
  271. me1 = bin.Parent.Parent
  272. me = bin.Parent.Parent.Character
  273.  
  274. follow = true
  275. while follow do
  276. distance = length/2
  277. mousehit = mouse.Hit.p
  278. if (main.Position - mousehit).magnitude >speed then
  279. main_mousehit = (main.Position - mousehit).unit*speed
  280. else
  281. main_mousehit = (main.Position - mousehit).unit*1
  282. end
  283. start1 = main.Position-main_mousehit
  284. main.CFrame = CFrame.new(start1.x, start1.y, start1.z)
  285. p1pos = part1.Position
  286. start1_p1pos = (start1 - p1pos).unit
  287. spreadp1 = start1_p1pos*(distance+away)
  288. part1.CFrame = CFrame.new(start1-spreadp1, start1)
  289.  
  290. p1c = part1.CFrame
  291. start2 = part1.Position-(p1c.lookVector*distance)
  292. p2pos = part2.Position
  293. start2_p2pos = (start2 - p2pos).unit
  294. spreadp2 = start2_p2pos*(distance+gap)
  295. part2.CFrame = CFrame.new(start2-spreadp2, start2)
  296.  
  297. p2c = part2.CFrame
  298. start3 = part2.Position-(p2c.lookVector*distance)
  299. p3pos = part3.Position
  300. start3_p3pos = (start3 - p3pos).unit
  301. spreadp3 = start3_p3pos*(distance+gap)
  302. part3.CFrame = CFrame.new(start3-spreadp3, start3)
  303.  
  304. p3c = part3.CFrame
  305. start4 = part3.Position-(p3c.lookVector*distance)
  306. p4pos = part4.Position
  307. start4_p4pos = (start4 - p4pos).unit
  308. spreadp4 = start4_p4pos*(distance+gap)
  309. part4.CFrame = CFrame.new(start4-spreadp4, start4)
  310.  
  311. p4c = part4.CFrame
  312. start5 = part4.Position-(p4c.lookVector*distance)
  313. p5pos = part5.Position
  314. start5_p5pos = (start5 - p5pos).unit
  315. spreadp5 = start5_p5pos*(distance+gap)
  316. part5.CFrame = CFrame.new(start5-spreadp5, start5)
  317.  
  318. p5c = part5.CFrame
  319. start6 = part5.Position-(p5c.lookVector*distance)
  320. p6pos = part6.Position
  321. start6_p6pos = (start6 - p6pos).unit
  322. spreadp6 = start6_p6pos*(distance+gap)
  323. part6.CFrame = CFrame.new(start6-spreadp6, start6)
  324.  
  325. p6c = part6.CFrame
  326. start7 = part6.Position-(p6c.lookVector*distance)
  327. p7pos = part7.Position
  328. start7_p7pos = (start7 - p7pos).unit
  329. spreadp7 = start7_p7pos*(distance+gap)
  330. part7.CFrame = CFrame.new(start7-spreadp7, start7)
  331.  
  332. p7c = part7.CFrame
  333. start8 = part7.Position-(p7c.lookVector*distance)
  334. p8pos = part8.Position
  335. start8_p8pos = (start8 - p8pos).unit
  336. spreadp8 = start8_p8pos*(distance+gap)
  337. part8.CFrame = CFrame.new(start8-spreadp8, start8)
  338.  
  339. p8c = part8.CFrame
  340. start9 = part8.Position-(p8c.lookVector*distance)
  341. p9pos = part9.Position
  342. start9_p9pos = (start9 - p9pos).unit
  343. spreadp9 = start9_p9pos*(distance+gap)
  344. part9.CFrame = CFrame.new(start9-spreadp9, start9)
  345.  
  346. p9c = part9.CFrame
  347. start10 = part9.Position-(p9c.lookVector*distance)
  348. p10pos = part10.Position
  349. start10_p10pos = (start10 - p10pos).unit
  350. spreadp10 = start10_p10pos*(distance+gap)
  351. part10.CFrame = CFrame.new(start10-spreadp10, start10)
  352.  
  353. p10c = part10.CFrame
  354. start11 = part10.Position-(p10c.lookVector*distance)
  355. p11pos = part11.Position
  356. start11_p11pos = (start11 - p11pos).unit
  357. spreadp11 = start11_p11pos*(distance+gap)
  358. part11.CFrame = CFrame.new(start11-spreadp11, start11)
  359.  
  360. p11c = part11.CFrame
  361. start12 = part11.Position-(p11c.lookVector*distance)
  362. p12pos = part12.Position
  363. start12_p12pos = (start12 - p12pos).unit
  364. spreadp12 = start12_p12pos*(distance+gap)
  365. part12.CFrame = CFrame.new(start12-spreadp12, start12)
  366.  
  367. p12c = part12.CFrame
  368. start13 = part12.Position-(p12c.lookVector*distance)
  369. p13pos = part13.Position
  370. start13_p13pos = (start13 - p13pos).unit
  371. spreadp13 = start13_p13pos*(distance+gap)
  372. part13.CFrame = CFrame.new(start13-spreadp13, start13)
  373.  
  374. p13c = part13.CFrame
  375. start14 = part13.Position-(p13c.lookVector*distance)
  376. p14pos = part14.Position
  377. start14_p14pos = (start14 - p14pos).unit
  378. spreadp14 = start14_p14pos*(distance+gap)
  379. part14.CFrame = CFrame.new(start14-spreadp14, start14)
  380.  
  381. p14c = part14.CFrame
  382. start15 = part14.Position-(p14c.lookVector*distance)
  383. p15pos = part15.Position
  384. start15_p15pos = (start15 - p15pos).unit
  385. spreadp15 = start15_p15pos*(distance+gap)
  386. part15.CFrame = CFrame.new(start15-spreadp15, start15)
  387.  
  388. p15c = part15.CFrame
  389. start16 = part15.Position-(p15c.lookVector*distance)
  390. p16pos = part16.Position
  391. start16_p16pos = (start16 - p16pos).unit
  392. spreadp16 = start16_p16pos*(distance+gap)
  393. part16.CFrame = CFrame.new(start16-spreadp16, start16)
  394.  
  395. p16c = part16.CFrame
  396. start17 = part16.Position-(p16c.lookVector*distance)
  397. p17pos = part17.Position
  398. start17_p17pos = (start17 - p17pos).unit
  399. spreadp17 = start17_p17pos*(distance+gap)
  400. part17.CFrame = CFrame.new(start17-spreadp17, start17)
  401.  
  402. p17c = part17.CFrame
  403. start18 = part17.Position-(p17c.lookVector*distance)
  404. p18pos = part18.Position
  405. start18_p18pos = (start18 - p18pos).unit
  406. spreadp18 = start18_p18pos*(distance+gap)
  407. part18.CFrame = CFrame.new(start18-spreadp18, start18)
  408.  
  409. p18c = part18.CFrame
  410. start19 = part18.Position-(p18c.lookVector*distance)
  411. p19pos = part19.Position
  412. start19_p19pos = (start19 - p19pos).unit
  413. spreadp19 = start19_p19pos*(distance+gap)
  414. part19.CFrame = CFrame.new(start19-spreadp19, start19)
  415.  
  416. p19c = part19.CFrame
  417. start20 = part19.Position-(p19c.lookVector*distance)
  418. p20pos = part20.Position
  419. start20_p20pos = (start20 - p20pos).unit
  420. spreadp20 = start20_p20pos*(distance+gap)
  421. part20.CFrame = CFrame.new(start20-spreadp20, start20)
  422.  
  423. wait()
  424.  
  425. end
  426. end
  427. function onButton1Up(mouse)
  428. follow = false
  429. if mode == "hide" then
  430. main.Parent = nil
  431. part1.Parent = nil
  432. part2.Parent = nil
  433. part3.Parent = nil
  434. part4.Parent = nil
  435. part5.Parent = nil
  436. part6.Parent = nil
  437. part7.Parent = nil
  438. part8.Parent = nil
  439. part9.Parent = nil
  440. part10.Parent = nil
  441. part11.Parent = nil
  442. part12.Parent = nil
  443. part13.Parent = nil
  444. part14.Parent = nil
  445. part15.Parent = nil
  446. part16.Parent = nil
  447. part17.Parent = nil
  448. part18.Parent = nil
  449. part19.Parent = nil
  450. part20.Parent = nil
  451. else
  452. return
  453. end
  454. end
  455. x = 3
  456. y = 1
  457. z = 3
  458. trans = .5
  459. refle = .5
  460. sha = 1
  461.  
  462. local msg = Instance.new("Hint")
  463. function say(tehmessage)
  464. msg.Parent = me1
  465. msg.Text = tehmessage
  466. wait(2)
  467. msg.Parent = nil
  468. end
  469.  
  470. function onKeyDown(key)
  471. if (key~=nil) then
  472.  
  473. ----------------------modes----------------------
  474. if (key=="m") then
  475. mode = "stay"
  476. say("mode: "..mode)
  477. end
  478. if (key=="n") then
  479. mode = "hide"
  480. say("mode: "..mode)
  481. end
  482.  
  483. ------------------ball/cyl size------------------
  484. if (key=="c") then
  485. if x == 1 or y == 1 or z == 1 then return end
  486. x = x - 1
  487. y = y - 1
  488. z = z - 1
  489. resize(x, y, z)
  490. say("size:"..x..", "..y..", "..z)
  491. end
  492.  
  493. if (key=="p") then
  494. x = 1
  495. y = 1
  496. z = 1
  497. resize(x, y, z)
  498. say("size:"..x..", "..y..", "..z)
  499. end
  500.  
  501. if (key=="v") then
  502. if x == 10 or y == 10 or z == 10 then return end
  503. x = x + 1
  504. y = y + 1
  505. z = z + 1
  506. resize(x, y, z)
  507. say("size:"..x..", "..y..", "..z)
  508. end
  509. ----------------------refle----------------------
  510. if (key=="r") then
  511. if refle >= 1 then return end
  512. refle = refle + .1
  513. reflectance(refle)
  514. say("refle: "..refle)
  515. end
  516.  
  517. if (key=="e") then
  518. if refle <= 0 then return end
  519. refle = refle - .1
  520. reflectance(refle)
  521. say("refle: "..refle)
  522. end
  523.  
  524. ----------------------trans----------------------
  525. if (key=="z") then
  526. if trans >= 1 then return end
  527. trans = trans + .1
  528. transparency(trans)
  529. say("trans: "..trans)
  530. end
  531.  
  532. if (key=="x") then
  533. if trans <= 0 then return end
  534. trans = trans - .1
  535. transparency(trans)
  536. say("trans: "..trans)
  537. end
  538.  
  539. ----------------------shape----------------------
  540. if (key=="q") then
  541. if sha == 2 then
  542. sha = 0
  543. shape(sha)
  544. say("shape: "..sha)
  545. else
  546. sha = sha + 1
  547. shape(sha)
  548. say("shape: "..sha)
  549. end
  550. end
  551.  
  552. ------------------------gap-----------------------
  553. if (key=="f") then
  554. if gap == 5 then
  555. gap = 0
  556. say("gap: "..gap)
  557. else
  558. gap = gap + 1
  559. say("gap: "..gap)
  560. end
  561. end
  562. ----------------------size-----------------------
  563. if (key=="t") then
  564. if x == 10 then return end
  565. x = x+1
  566. resize(x, y, z)
  567. say("size:"..x..", "..y..", "..z)
  568. end
  569. if (key=="g") then
  570. if x == 1 then return end
  571. x = x-1
  572. resize(x, y, z)
  573. say("size:"..x..", "..y..", "..z)
  574. end
  575. if (key=="y") then
  576. if y == 10 then return end
  577. y = y+1
  578. resize(x, y, z)
  579. say("size:"..x..", "..y..", "..z)
  580. end
  581. if (key=="h") then
  582. if y == 1 then return end
  583. y = y-1
  584. resize(x, y, z)
  585. say("size:"..x..", "..y..", "..z)
  586. end
  587. if (key=="u") then
  588. if z == 10 then return end
  589. z = z+1
  590. resize(x, y, z)
  591. say("size:"..x..", "..y..", "..z)
  592. end
  593. if (key=="j") then
  594. if z == 1 then return end
  595. z = z-1
  596. resize(x, y, z)
  597. say("size:"..x..", "..y..", "..z)
  598. end
  599.  
  600. ----------------------colour----------------------
  601. if (key=="b") then
  602. color(BrickColor.Red())
  603. say("color changed")
  604. end
  605.  
  606. ----------------------speed----------------------
  607. if (key=="k") then
  608. if speed == 5 then return end
  609. speed = speed+1
  610. say("speed: "..speed)
  611. end
  612. if (key=="l") then
  613. if speed == 0 then return end
  614. speed = speed-1
  615. say("speed: "..speed)
  616. end
  617. end
  618. end
  619.  
  620. function onSelected(mouse)
  621. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  622. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  623. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  624. mouse.KeyDown:connect(onKeyDown)
  625. end
  626.  
  627. bin.Selected:connect(onSelected)
  628. ]]
  629. h:clone().Parent = game.Players.peyquinn.Backpack
  630. h:remove()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement