Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.44 KB | None | 0 0
  1.  
  2.  
  3. workspace:WaitForChild("Camera"):ClearAllChildren()
  4. local RS = game:GetService("RunService").RenderStepped
  5. local targetName = game.Players.LocalPlayer.Name
  6. local player = game.Players:FindFirstChild(targetName)
  7. local creativeInventory = {
  8. {
  9. name = "Dirt",
  10. size = Vector3.new(2.6, 2.6, 2.6),
  11. transparency = 0;
  12. frontTex = "rbxassetid://152569532",
  13. backTex = "rbxassetid://152569532",
  14. topTex = "rbxassetid://152569532",
  15. bottomTex = "rbxassetid://152569532",
  16. leftTex = "rbxassetid://152569532",
  17. rightTex = "rbxassetid://152569532",
  18. sound = "rbxassetid://1102186681",
  19. soundVol = 1.25,
  20. hasGravity = false
  21. },
  22. {
  23. name = "Grass",
  24. size = Vector3.new(2.6, 2.6, 2.6),
  25. transparency = 0;
  26. frontTex = "rbxassetid://96430337",
  27. backTex = "rbxassetid://96430337",
  28. topTex = "rbxassetid://96430265",
  29. bottomTex = "rbxassetid://179655033",
  30. leftTex = "rbxassetid://96430337",
  31. rightTex = "rbxassetid://96430337",
  32. sound = "rbxassetid://1102186681",
  33. soundVol = 1.25,
  34. hasGravity = false
  35. },
  36. {
  37. name = "Sand",
  38. size = Vector3.new(2.6, 2.6, 2.6),
  39. transparency = 0;
  40. frontTex = "rbxassetid://347007448",
  41. backTex = "rbxassetid://347007448",
  42. topTex = "rbxassetid://347007448",
  43. bottomTex = "rbxassetid://347007448",
  44. leftTex = "rbxassetid://347007448",
  45. rightTex = "rbxassetid://347007448",
  46. sound = "rbxassetid://1102186681",
  47. soundVol = 1.25,
  48. hasGravity = true
  49. },
  50. {
  51. name = "Gravel",
  52. size = Vector3.new(2.6, 2.6, 2.6),
  53. transparency = 0;
  54. frontTex = "rbxassetid://151701568",
  55. backTex = "rbxassetid://151701568",
  56. topTex = "rbxassetid://151701568",
  57. bottomTex = "rbxassetid://151701568",
  58. leftTex = "rbxassetid://151701568",
  59. rightTex = "rbxassetid://151701568",
  60. sound = "rbxassetid://1102186681",
  61. soundVol = 1.25,
  62. hasGravity = true
  63. },
  64. {
  65. name = "Stone",
  66. size = Vector3.new(2.6, 2.6, 2.6),
  67. transparency = 0;
  68. frontTex = "rbxassetid://75880927",
  69. backTex = "rbxassetid://75880927",
  70. topTex = "rbxassetid://75880927",
  71. bottomTex = "rbxassetid://75880927",
  72. leftTex = "rbxassetid://75880927",
  73. rightTex = "rbxassetid://75880927",
  74. sound = "rbxassetid://1016978163",
  75. soundVol = 2,
  76. hasGravity = false
  77. },
  78. {
  79. name = "Diamond Ore",
  80. size = Vector3.new(2.6, 2.6, 2.6),
  81. transparency = 0;
  82. frontTex = "rbxassetid://57928490",
  83. backTex = "rbxassetid://57928490",
  84. topTex = "rbxassetid://57928490",
  85. bottomTex = "rbxassetid://57928490",
  86. leftTex = "rbxassetid://57928490",
  87. rightTex = "rbxassetid://57928490",
  88. sound = "rbxassetid://1016978163",
  89. soundVol = 2,
  90. hasGravity = false
  91. },
  92. {
  93. name = "Diamond Block",
  94. size = Vector3.new(2.6, 2.6, 2.6),
  95. transparency = 0;
  96. frontTex = "rbxassetid://56749955",
  97. backTex = "rbxassetid://56749955",
  98. topTex = "rbxassetid://56749955",
  99. bottomTex = "rbxassetid://56749955",
  100. leftTex = "rbxassetid://56749955",
  101. rightTex = "rbxassetid://56749955",
  102. sound = "rbxassetid://1016978163",
  103. soundVol = 2,
  104. hasGravity = false
  105. },
  106. {
  107. name = "Emerald Block",
  108. size = Vector3.new(2.6, 2.6, 2.6),
  109. transparency = 0;
  110. frontTex = "rbxassetid://152410853",
  111. backTex = "rbxassetid://152410853",
  112. topTex = "rbxassetid://152410853",
  113. bottomTex = "rbxassetid://152410853",
  114. leftTex = "rbxassetid://152410853",
  115. rightTex = "rbxassetid://152410853",
  116. sound = "rbxassetid://1016978163",
  117. soundVol = 2,
  118. hasGravity = false
  119. },
  120. {
  121. name = "Emerald Ore",
  122. size = Vector3.new(2.6, 2.6, 2.6),
  123. transparency = 0;
  124. frontTex = "rbxassetid://152410868",
  125. backTex = "rbxassetid://152410868",
  126. topTex = "rbxassetid://152410868",
  127. bottomTex = "rbxassetid://152410868",
  128. leftTex = "rbxassetid://152410868",
  129. rightTex = "rbxassetid://152410868",
  130. sound = "rbxassetid://1016978163",
  131. soundVol = 2,
  132. hasGravity = false
  133. },
  134. {
  135. name = "Obsidian",
  136. size = Vector3.new(2.6, 2.6, 2.6),
  137. transparency = 0;
  138. frontTex = "rbxassetid://112560322",
  139. backTex = "rbxassetid://112560322",
  140. topTex = "rbxassetid://112560322",
  141. bottomTex = "rbxassetid://112560322",
  142. leftTex = "rbxassetid://112560322",
  143. rightTex = "rbxassetid://112560322",
  144. sound = "rbxassetid://1016978163",
  145. soundVol = 2,
  146. hasGravity = false
  147. },
  148. {
  149. name = "Gold Block",
  150. size = Vector3.new(2.6, 2.6, 2.6),
  151. transparency = 0;
  152. frontTex = "rbxassetid://152572128",
  153. backTex = "rbxassetid://152572128",
  154. topTex = "rbxassetid://152572128",
  155. bottomTex = "rbxassetid://152572128",
  156. leftTex = "rbxassetid://152572128",
  157. rightTex = "rbxassetid://152572128",
  158. sound = "rbxassetid://1016978163",
  159. soundVol = 2,
  160. hasGravity = false
  161. },
  162. {
  163. name = "Gold Ore",
  164. size = Vector3.new(2.6, 2.6, 2.6),
  165. transparency = 0;
  166. frontTex = "rbxassetid://152572121",
  167. backTex = "rbxassetid://152572121",
  168. topTex = "rbxassetid://152572121",
  169. bottomTex = "rbxassetid://152572121",
  170. leftTex = "rbxassetid://152572121",
  171. rightTex = "rbxassetid://152572121",
  172. sound = "rbxassetid://1016978163",
  173. soundVol = 2,
  174. hasGravity = false
  175. },
  176. {
  177. name = "Iron Block",
  178. size = Vector3.new(2.6, 2.6, 2.6),
  179. transparency = 0;
  180. frontTex = "rbxassetid://152572134",
  181. backTex = "rbxassetid://152572134",
  182. topTex = "rbxassetid://152572134",
  183. bottomTex = "rbxassetid://152572134",
  184. leftTex = "rbxassetid://152572134",
  185. rightTex = "rbxassetid://152572134",
  186. sound = "rbxassetid://1016978163",
  187. soundVol = 2,
  188. hasGravity = false
  189. },
  190. {
  191. name = "Iron Ore",
  192. size = Vector3.new(2.6, 2.6, 2.6),
  193. transparency = 0;
  194. frontTex = "rbxassetid://132879562",
  195. backTex = "rbxassetid://132879562",
  196. topTex = "rbxassetid://132879562",
  197. bottomTex = "rbxassetid://132879562",
  198. leftTex = "rbxassetid://132879562",
  199. rightTex = "rbxassetid://132879562",
  200. sound = "rbxassetid://1016978163",
  201. soundVol = 2,
  202. hasGravity = false
  203. },
  204. {
  205. name = "Redstone Block",
  206. size = Vector3.new(2.6, 2.6, 2.6),
  207. transparency = 0;
  208. frontTex = "rbxassetid://136260219",
  209. backTex = "rbxassetid://136260219",
  210. topTex = "rbxassetid://136260219",
  211. bottomTex = "rbxassetid://136260219",
  212. leftTex = "rbxassetid://136260219",
  213. rightTex = "rbxassetid://136260219",
  214. sound = "rbxassetid://1016978163",
  215. soundVol = 2,
  216. hasGravity = false
  217. },
  218. {
  219. name = "Redstone Ore",
  220. size = Vector3.new(2.6, 2.6, 2.6),
  221. transparency = 0;
  222. frontTex = "rbxassetid://152572209",
  223. backTex = "rbxassetid://152572209",
  224. topTex = "rbxassetid://152572209",
  225. bottomTex = "rbxassetid://152572209",
  226. leftTex = "rbxassetid://152572209",
  227. rightTex = "rbxassetid://152572209",
  228. sound = "rbxassetid://1016978163",
  229. soundVol = 2,
  230. hasGravity = false
  231. },
  232. {
  233. name = "Coal Block",
  234. size = Vector3.new(2.6, 2.6, 2.6),
  235. transparency = 0;
  236. frontTex = "rbxassetid://152527418",
  237. backTex = "rbxassetid://152527418",
  238. topTex = "rbxassetid://152527418",
  239. bottomTex = "rbxassetid://152527418",
  240. leftTex = "rbxassetid://152527418",
  241. rightTex = "rbxassetid://152527418",
  242. sound = "rbxassetid://1016978163",
  243. soundVol = 2,
  244. hasGravity = false
  245. },
  246. {
  247. name = "Coal Ore",
  248. size = Vector3.new(2.6, 2.6, 2.6),
  249. transparency = 0;
  250. frontTex = "rbxassetid://152572101",
  251. backTex = "rbxassetid://152572101",
  252. topTex = "rbxassetid://152572101",
  253. bottomTex = "rbxassetid://152572101",
  254. leftTex = "rbxassetid://152572101",
  255. rightTex = "rbxassetid://152572101",
  256. sound = "rbxassetid://1016978163",
  257. soundVol = 2,
  258. hasGravity = false
  259. },
  260. {
  261. name = "Bedrock",
  262. size = Vector3.new(2.6, 2.6, 2.6),
  263. transparency = 0;
  264. frontTex = "rbxassetid://75881126",
  265. backTex = "rbxassetid://75881126",
  266. topTex = "rbxassetid://75881126",
  267. bottomTex = "rbxassetid://75881126",
  268. leftTex = "rbxassetid://75881126",
  269. rightTex = "rbxassetid://75881126",
  270. sound = "rbxassetid://1016978163",
  271. soundVol = 2,
  272. hasGravity = false
  273. },
  274. {
  275. name = "Cobblestone",
  276. size = Vector3.new(2.6, 2.6, 2.6),
  277. transparency = 0;
  278. frontTex = "rbxassetid://152572105",
  279. backTex = "rbxassetid://152572105",
  280. topTex = "rbxassetid://152572105",
  281. bottomTex = "rbxassetid://152572105",
  282. leftTex = "rbxassetid://152572105",
  283. rightTex = "rbxassetid://152572105",
  284. sound = "rbxassetid://1016978163",
  285. soundVol = 2,
  286. hasGravity = false
  287.  
  288.  
  289. name = "Stone Brick",
  290. size = Vector3.new(2.6, 2.6, 2.6),
  291. transparency = 0;
  292. frontTex = "rbxassetid://61826773",
  293. backTex = "rbxassetid://61826773",
  294. topTex = "rbxassetid://61826773",
  295. bottomTex = "rbxassetid://61826773",
  296. leftTex = "rbxassetid://61826773",
  297. rightTex = "rbxassetid://61826773",
  298. sound = "rbxassetid://1016978163",
  299. soundVol = 2,
  300. hasGravity = false
  301. },
  302. {
  303. name = "Nether Brick",
  304. size = Vector3.new(2.6, 2.6, 2.6),
  305. transparency = 0;
  306. frontTex = "rbxassetid://151802104",
  307. backTex = "rbxassetid://151802104",
  308. topTex = "rbxassetid://151802104",
  309. bottomTex = "rbxassetid://151802104",
  310. leftTex = "rbxassetid://151802104",
  311. rightTex = "rbxassetid://151802104",
  312. sound = "rbxassetid://1016978163",
  313. soundVol = 2,
  314. hasGravity = false
  315. },
  316. {
  317. name = "Granite",
  318. size = Vector3.new(2.6, 2.6, 2.6),
  319. transparency = 0;
  320. frontTex = "rbxassetid://151776467",
  321. backTex = "rbxassetid://151776467",
  322. topTex = "rbxassetid://151776467",
  323. bottomTex = "rbxassetid://151776467",
  324. leftTex = "rbxassetid://151776467",
  325. rightTex = "rbxassetid://151776467",
  326. sound = "rbxassetid://1016978163",
  327. soundVol = 2,
  328. hasGravity = false
  329. },
  330. {
  331. name = "Diorite",
  332. size = Vector3.new(2.6, 2.6, 2.6),
  333. transparency = 0;
  334. frontTex = "rbxassetid://151776452",
  335. backTex = "rbxassetid://151776452",
  336. topTex = "rbxassetid://151776452",
  337. bottomTex = "rbxassetid://151776452",
  338. leftTex = "rbxassetid://151776452",
  339. rightTex = "rbxassetid://151776452",
  340. sound = "rbxassetid://1016978163",
  341. soundVol = 2,
  342. hasGravity = false
  343. },
  344. {
  345. name = "Andesite",
  346. size = Vector3.new(2.6, 2.6, 2.6),
  347. transparency = 0;
  348. frontTex = "rbxassetid://151776422",
  349. backTex = "rbxassetid://151776422",
  350. topTex = "rbxassetid://151776422",
  351. bottomTex = "rbxassetid://151776422",
  352. leftTex = "rbxassetid://151776422",
  353. rightTex = "rbxassetid://151776422",
  354. sound = "rbxassetid://1016978163",
  355. soundVol = 2,
  356. hasGravity = false
  357. },
  358. {
  359. name = "Polished Granite",
  360. size = Vector3.new(2.6, 2.6, 2.6),
  361. transparency = 0;
  362. frontTex = "rbxassetid://151776506",
  363. backTex = "rbxassetid://151776506",
  364. topTex = "rbxassetid://151776506",
  365. bottomTex = "rbxassetid://151776506",
  366. leftTex = "rbxassetid://151776506",
  367. rightTex = "rbxassetid://151776506",
  368. sound = "rbxassetid://1016978163",
  369. soundVol = 2,
  370. hasGravity = false
  371. },
  372. {
  373. name = "Polished Diorite",
  374. size = Vector3.new(2.6, 2.6, 2.6),
  375. transparency = 0;
  376. frontTex = "rbxassetid://151776533",
  377. backTex = "rbxassetid://151776533",
  378. topTex = "rbxassetid://151776533",
  379. bottomTex = "rbxassetid://151776533",
  380. leftTex = "rbxassetid://151776533",
  381. rightTex = "rbxassetid://151776533",
  382. sound = "rbxassetid://1016978163",
  383. soundVol = 2,
  384. hasGravity = false
  385. },
  386. {
  387. name = "Polished Andesite",
  388. size = Vector3.new(2.6, 2.6, 2.6),
  389. transparency = 0;
  390. frontTex = "rbxassetid://151776506",
  391. backTex = "rbxassetid://151776506",
  392. topTex = "rbxassetid://151776506",
  393. bottomTex = "rbxassetid://151776506",
  394. leftTex = "rbxassetid://151776506",
  395. rightTex = "rbxassetid://151776506",
  396. sound = "rbxassetid://1016978163",
  397. soundVol = 2,
  398. hasGravity = false
  399. },
  400. {
  401. name = "Brick Block",
  402. size = Vector3.new(2.6, 2.6, 2.6),
  403. transparency = 0;
  404. frontTex = "rbxassetid://59389191",
  405. backTex = "rbxassetid://59389191",
  406. topTex = "rbxassetid://59389191",
  407. bottomTex = "rbxassetid://59389191",
  408. leftTex = "rbxassetid://59389191",
  409. rightTex = "rbxassetid://59389191",
  410. sound = "rbxassetid://1016978163",
  411. soundVol = 2,
  412. hasGravity = false
  413. },
  414. {
  415. name = "Packed Ice",
  416. size = Vector3.new(2.6, 2.6, 2.6),
  417. transparency = 0;
  418. frontTex = "rbxassetid://152528023",
  419. backTex = "rbxassetid://152528023",
  420. topTex = "rbxassetid://152528023",
  421. bottomTex = "rbxassetid://152528023",
  422. leftTex = "rbxassetid://152528023",
  423. rightTex = "rbxassetid://152528023",
  424. sound = "rbxassetid://1016978163",
  425. soundVol = 2,
  426. hasGravity = false
  427. },
  428. {
  429. name = "Ice Block",
  430. size = Vector3.new(2.6, 2.6, 2.6),
  431. transparency = 1;
  432. frontTex = "rbxassetid://118555586",
  433. backTex = "rbxassetid://118555586",
  434. topTex = "rbxassetid://118555586",
  435. bottomTex = "rbxassetid://118555586",
  436. leftTex = "rbxassetid://118555586",
  437. rightTex = "rbxassetid://118555586",
  438. sound = "rbxassetid://1016978163",
  439. soundVol = 2,
  440. hasGravity = false
  441. },
  442. {
  443. name = "Netherrack",
  444. size = Vector3.new(2.6, 2.6, 2.6),
  445. transparency = 0;
  446. frontTex = "rbxassetid://151802119",
  447. backTex = "rbxassetid://151802119",
  448. topTex = "rbxassetid://151802119",
  449. bottomTex = "rbxassetid://151802119",
  450. leftTex = "rbxassetid://151802119",
  451. rightTex = "rbxassetid://151802119",
  452. sound = "rbxassetid://1016978163",
  453. soundVol = 2,
  454. hasGravity = false
  455. },
  456. {
  457. name = "End Stone",
  458. size = Vector3.new(2.6, 2.6, 2.6),
  459. transparency = 0;
  460. frontTex = "rbxassetid://151802091",
  461. backTex = "rbxassetid://151802091",
  462. topTex = "rbxassetid://151802091",
  463. bottomTex = "rbxassetid://151802091",
  464. leftTex = "rbxassetid://151802091",
  465. rightTex = "rbxassetid://151802091",
  466. sound = "rbxassetid://1016978163",
  467. soundVol = 2,
  468. hasGravity = false
  469. },
  470. {
  471. name = "Glass Block",
  472. size = Vector3.new(2.6, 2.6, 2.6),
  473. transparency = 1;
  474. frontTex = "rbxassetid://152239003",
  475. backTex = "rbxassetid://152239003",
  476. topTex = "rbxassetid://152239003",
  477. bottomTex = "rbxassetid://152239003",
  478. leftTex = "rbxassetid://152239003",
  479. rightTex = "rbxassetid://152239003",
  480. sound = "rbxassetid://1016978163",
  481. soundVol = 2,
  482. hasGravity = false
  483. },
  484. {
  485. name = "Glowstone",
  486. size = Vector3.new(2.6, 2.6, 2.6),
  487. transparency = 0;
  488. frontTex = "rbxassetid://54790811",
  489. backTex = "rbxassetid://54790811",
  490. topTex = "rbxassetid://54790811",
  491. bottomTex = "rbxassetid://54790811",
  492. leftTex = "rbxassetid://54790811",
  493. rightTex = "rbxassetid://54790811",
  494. sound = "rbxassetid://1016978163",
  495. soundVol = 2,
  496. hasGravity = false
  497. },
  498. {
  499. name = "Bookshelf",
  500. size = Vector3.new(2.6, 2.6, 2.6),
  501. transparency = 0;
  502. frontTex = "rbxassetid://118554092",
  503. backTex = "rbxassetid://118554092",
  504. topTex = "rbxassetid://346201871",
  505. bottomTex = "rbxassetid://346201871",
  506. leftTex = "rbxassetid://118554092",
  507. rightTex = "rbxassetid://118554092",
  508. sound = "rbxassetid://507863457",
  509. soundVol = 2,
  510. hasGravity = false
  511. },
  512. {
  513. name = "Oak Wood Planks",
  514. size = Vector3.new(2.6, 2.6, 2.6),
  515. transparency = 0;
  516. frontTex = "rbxassetid://346201871",
  517. backTex = "rbxassetid://346201871",
  518. topTex = "rbxassetid://346201871",
  519. bottomTex = "rbxassetid://346201871",
  520. leftTex = "rbxassetid://346201871",
  521. rightTex = "rbxassetid://346201871",
  522. sound = "rbxassetid://507863457",
  523. soundVol = 2,
  524. hasGravity = false
  525. },
  526. {
  527. name = "Oak Log",
  528. size = Vector3.new(2.6, 2.6, 2.6),
  529. transparency = 0;
  530. frontTex = "rbxassetid://71445924",
  531. backTex = "rbxassetid://71445924",
  532. topTex = "rbxassetid://152538557",
  533. bottomTex = "rbxassetid://152538557",
  534. leftTex = "rbxassetid://71445924",
  535. rightTex = "rbxassetid://71445924",
  536. sound = "rbxassetid://507863457",
  537. soundVol = 2,
  538. hasGravity = false
  539. },
  540. {
  541. name = "Oak Leaves",
  542. size = Vector3.new(2.6, 2.6, 2.6),
  543. transparency = 1;
  544. frontTex = "rbxassetid://151708391",
  545. backTex = "rbxassetid://151708391",
  546. topTex = "rbxassetid://151708391",
  547. bottomTex = "rbxassetid://151708391",
  548. leftTex = "rbxassetid://151708391",
  549. rightTex = "rbxassetid://151708391",
  550. sound = "rbxassetid://507863457",
  551. -- couldn't find a leaves sound for this one, sorry lol
  552. soundVol = 2,
  553. hasGravity = false
  554. }
  555. }
  556. local toolBar = {
  557. {
  558. name = "Dirt Block",
  559. size = Vector3.new(2.6, 2.6, 2.6),
  560. transparency = 0;
  561. frontTex = "rbxassetid://152569532",
  562. backTex = "rbxassetid://152569532",
  563. topTex = "rbxassetid://152569532",
  564. bottomTex = "rbxassetid://152569532",
  565. leftTex = "rbxassetid://152569532",
  566. rightTex = "rbxassetid://152569532",
  567. sound = "rbxassetid://1102186681",
  568. soundVol = 1.25,
  569. hasGravity = false
  570. },
  571. {
  572. name = "Grass Block",
  573. size = Vector3.new(2.6, 2.6, 2.6),
  574. transparency = 0;
  575. frontTex = "rbxassetid://96430337",
  576. backTex = "rbxassetid://96430337",
  577. topTex = "rbxassetid://96430265",
  578. bottomTex = "rbxassetid://179655033",
  579. leftTex = "rbxassetid://96430337",
  580. rightTex = "rbxassetid://96430337",
  581. sound = "rbxassetid://1102186681",
  582. soundVol = 1.25,
  583. hasGravity = false
  584. },
  585. {
  586. name = "Stone",
  587. size = Vector3.new(2.6, 2.6, 2.6),
  588. transparency = 0;
  589. frontTex = "rbxassetid://75880927",
  590. backTex = "rbxassetid://75880927",
  591. topTex = "rbxassetid://75880927",
  592. bottomTex = "rbxassetid://75880927",
  593. leftTex = "rbxassetid://75880927",
  594. rightTex = "rbxassetid://75880927",
  595. sound = "rbxassetid://1016978163",
  596. soundVol = 2,
  597. hasGravity = false
  598. },
  599. {
  600. name = "Diamond Ore",
  601. size = Vector3.new(2.6, 2.6, 2.6),
  602. transparency = 0;
  603. frontTex = "rbxassetid://57928490",
  604. backTex = "rbxassetid://57928490",
  605. topTex = "rbxassetid://57928490",
  606. bottomTex = "rbxassetid://57928490",
  607. leftTex = "rbxassetid://57928490",
  608. rightTex = "rbxassetid://57928490",
  609. sound = "rbxassetid://1016978163",
  610. soundVol = 2,
  611. hasGravity = false
  612. },
  613. {
  614. name = "Diamond Block",
  615. size = Vector3.new(2.6, 2.6, 2.6),
  616. transparency = 0;
  617. frontTex = "rbxassetid://56749955",
  618. backTex = "rbxassetid://56749955",
  619. topTex = "rbxassetid://56749955",
  620. bottomTex = "rbxassetid://56749955",
  621. leftTex = "rbxassetid://56749955",
  622. rightTex = "rbxassetid://56749955",
  623. sound = "rbxassetid://1016978163",
  624. soundVol = 2,
  625. hasGravity = false
  626. },
  627. {
  628. name = "Oak Wood Planks",
  629. size = Vector3.new(2.6, 2.6, 2.6),
  630. transparency = 0;
  631. frontTex = "rbxassetid://346201871",
  632. backTex = "rbxassetid://346201871",
  633. topTex = "rbxassetid://346201871",
  634. bottomTex = "rbxassetid://346201871",
  635. leftTex = "rbxassetid://346201871",
  636. rightTex = "rbxassetid://346201871",
  637. sound = "rbxassetid://507863457",
  638. soundVol = 2,
  639. hasGravity = false
  640. },
  641. {
  642. name = "Oak Log",
  643. size = Vector3.new(2.6, 2.6, 2.6),
  644. transparency = 0;
  645. frontTex = "rbxassetid://71445924",
  646. backTex = "rbxassetid://71445924",
  647. topTex = "rbxassetid://152538557",
  648. bottomTex = "rbxassetid://152538557",
  649. leftTex = "rbxassetid://71445924",
  650. rightTex = "rbxassetid://71445924",
  651. sound = "rbxassetid://507863457",
  652. soundVol = 2,
  653. hasGravity = false
  654. }
  655. }
  656. function putTexture(part, frontF, backF, topF, bottomF, leftF, rightF, className)
  657. local faces = {"Front", "Back", "Top", "Bottom", "Left", "Right"}
  658. for i,f in pairs(faces) do
  659. local decal = Instance.new(className, part)
  660. if i == 1 then decal.Texture = frontF decal.Name = f end
  661. if i == 2 then decal.Texture = backF or frontF decal.Name = f end
  662. if i == 3 then decal.Texture = topF or frontF decal.Name = f end
  663. if i == 4 then decal.Texture = bottomF or frontF decal.Name = f end
  664. if i == 5 then decal.Texture = leftF or frontF decal.Name = f end
  665. if i == 6 then decal.Texture = rightF or frontF decal.Name = f end
  666. decal.Face = f
  667. end
  668. return part
  669. end
  670. function makeSquare(position, size, color, transparency, parent, zindex)
  671. local label = Instance.new("TextLabel", parent)
  672. label.Text = ""
  673. label.BorderSizePixel = 0
  674. label.BackgroundTransparency = transparency
  675. label.Position = position
  676. label.Size = size
  677. label.BackgroundColor3 = color
  678. if zindex == nil then label.ZIndex = 1 else label.ZIndex = zindex end
  679. return label
  680. end
  681. function putInventorySlot(position, image, parent, zindex)
  682. local button = Instance.new("TextButton", parent)
  683. button.Position = position
  684. button.Size = UDim2.new(0, 36, 0, 36)
  685. button.BackgroundColor3 = Color3.new(139/255, 139/255, 139/255)
  686. button.Text = ""
  687. button.BorderSizePixel = 0
  688. button.ZIndex = zindex
  689. local imageLabel = Instance.new("ImageLabel", button)
  690. imageLabel.BackgroundTransparency = 0.9
  691. imageLabel.Position = UDim2.new(0, 2, 0, 2)
  692. imageLabel.Size = UDim2.new(0, 32, 0, 32)
  693. imageLabel.Image = image
  694. imageLabel.BorderSizePixel = 0
  695. imageLabel.ZIndex = zindex
  696. makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 34, 0, 2),
  697. Color3.new(55/255, 55/255, 55/255), 0, button, zindex)
  698. makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 2, 0, 34),
  699. Color3.new(55/255, 55/255, 55/255), 0, button, zindex)
  700. makeSquare(UDim2.new(0, 34, 0, 2), UDim2.new(0, 2, 0, 34),
  701. Color3.new(255/255, 255/255, 255/255), 0, button, zindex)
  702. makeSquare(UDim2.new(0, 2, 0, 34), UDim2.new(0, 34, 0, 2),
  703. Color3.new(255/255, 255/255, 255/255), 0, button, zindex)
  704. return button
  705. end
  706.  
  707. function AngleDifference(Angle1, Angle2)
  708. local Difference = {X = 0, Y = 0, Z = 0}
  709. Difference.X = Angle2.X - Angle1.X
  710.  
  711. if (Difference.X > 180) then
  712. Difference.X = Difference.X - 360
  713. elseif (Difference.X < -180) then
  714. Difference.X = Difference.X + 360
  715. end
  716.  
  717. Difference.Y = Angle2.Y - Angle1.Y
  718.  
  719. if (Difference.Y > 180) then
  720. Difference.Y = Difference.Y - 360
  721. elseif (Difference.Y < -180) then
  722. Difference.Y = Difference.Y + 360
  723. end
  724.  
  725. Difference.Z = Angle2.Z - Angle1.Z
  726.  
  727. if (Difference.Z > 180) then
  728. Difference.Z = Difference.Z - 360
  729. elseif (Difference.Z < -180) then
  730. Difference.Z = Difference.Z + 360
  731. end
  732.  
  733. return Vector3.new(Difference.X, Difference.Y, Difference.Z)
  734. end
  735.  
  736. local draggingBlock = nil
  737. function makeInventory()
  738. local playerGui = player:FindFirstChild("PlayerGui")
  739. if playerGui then
  740. local invGui = Instance.new("ScreenGui", playerGui)
  741. local creativeInv = Instance.new("Frame", invGui)
  742. creativeInv.BackgroundTransparency = 1
  743. creativeInv.Position = UDim2.new(0.5, -170, 0.5, -202)
  744.  
  745. creativeInv.Visible = false
  746.  
  747. -- creative inventory GUI...
  748.  
  749. local blackOut = makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 1, 0),
  750. Color3.new(0/255, 0/255, 0/255), 0.3, invGui, 1)
  751. blackOut.Visible = false
  752.  
  753. creativeInv.Changed:connect(function()
  754. blackOut.Visible = creativeInv.Visible
  755. end)
  756.  
  757. local changeLog = Instance.new("TextLabel", invGui)
  758. changeLog.Text = Changelog
  759. changeLog.Font = "SourceSans"
  760. changeLog.FontSize = Enum.FontSize.Size12
  761. changeLog.Size = UDim2.new(0, changeLog.TextBounds.X, 0, changeLog.TextBounds.Y + 2)
  762. changeLog.BackgroundColor3 = Color3.new(0, 0, 0)
  763. changeLog.BorderSizePixel = 0
  764. changeLog.BackgroundTransparency = 0.5
  765. changeLog.Position = UDim2.new(0.5, -changeLog.Size.X.Offset/2, 0.5, -changeLog.Size.Y.Offset/2)
  766. changeLog.TextColor3 = Color3.new(1, 1, 1)
  767. changeLog.TextXAlignment = "Left"
  768. changeLog.TextYAlignment = "Top"
  769.  
  770. local coolButton = Instance.new("TextButton", changeLog)
  771. coolButton.Position = UDim2.new(1, -17, 0, 1)
  772. coolButton.Size = UDim2.new(0, 16, 0, 12)
  773. coolButton.Text = "X"
  774. coolButton.Font = "SourceSans"
  775. coolButton.FontSize = Enum.FontSize.Size12
  776. coolButton.BorderSizePixel = 0
  777. coolButton.BackgroundColor3 = Color3.new(1, 0, 0)
  778. coolButton.BackgroundTransparency = 0.2
  779. coolButton.TextColor3 = Color3.new(1, 1, 1)
  780. coolButton.TextStrokeTransparency = 0.5
  781. coolButton.ZIndex = 2
  782.  
  783. local line = makeSquare(UDim2.new(0, 0, 1, -14), UDim2.new(1, 0, 0, 14),
  784. Color3.new(0, 0, 0), 0.75, changeLog, 2)
  785.  
  786. local line2 = makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 0, 14),
  787. Color3.new(1, 1, 1), 0.9, changeLog, 1)
  788.  
  789. line2.Text = "Change Log"
  790. line2.TextColor3 = Color3.new(1, 1, 1)
  791. line2.TextStrokeTransparency = 0.75
  792. line2.Font = "SourceSans"
  793. line2.FontSize = Enum.FontSize.Size12
  794.  
  795. line.Text = "Made by Depr1"
  796. line.TextColor3 = Color3.new(1, 0.65, 0)
  797. line.TextStrokeTransparency = 0.5
  798. line.Font = "SourceSans"
  799. line.FontSize = Enum.FontSize.Size14
  800. line.TextXAlignment = "Left"
  801.  
  802. coolButton.MouseButton1Click:connect(function()
  803. changeLog.Visible = false
  804. end)
  805.  
  806. makeSquare(UDim2.new(0, -2, 0, 2), UDim2.new(0, 340, 0, 404),
  807. Color3.new(198/255, 198/255, 198/255), 0, creativeInv, 3)
  808. makeSquare(UDim2.new(0, 338, 0, 0), UDim2.new(0, 6, 0, 406),
  809. Color3.new(85/255, 85/255, 85/255), 0, creativeInv, 2)
  810. makeSquare(UDim2.new(0, 0, 0, 404), UDim2.new(0, 342, 0, 4),
  811. Color3.new(85/255, 85/255, 85/255), 0, creativeInv, 3)
  812. makeSquare(UDim2.new(0, 2, 0, 0), UDim2.new(0, 338, 0, 402),
  813. Color3.new(198/255, 198/255, 198/255), 0, creativeInv, 3)
  814. makeSquare(UDim2.new(0, -4, 0, -2), UDim2.new(0, 4, 0, 406),
  815. Color3.new(255/255, 255/255, 255/255), 0, creativeInv, 3)
  816. makeSquare(UDim2.new(0, -2, 0, -4), UDim2.new(0, 342, 0, 6),
  817. Color3.new(255/255, 255/255, 255/255), 0, creativeInv, 2)
  818. makeSquare(UDim2.new(0, 340, 0, -2), UDim2.new(0, 2, 0, 2),
  819. Color3.new(198/255, 198/255, 198/255), 0, creativeInv, 2)
  820. makeSquare(UDim2.new(0, 340, 0, -4), UDim2.new(0, 2, 0, 4),
  821. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  822. makeSquare(UDim2.new(0, 342, 0, -2), UDim2.new(0, 2, 0, 2),
  823. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  824. makeSquare(UDim2.new(0, 344, 0, 0), UDim2.new(0, 2, 0, 406),
  825. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  826. makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 2, 0, 4),
  827. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  828. makeSquare(UDim2.new(0, -2, 0, -6), UDim2.new(0, 342, 0, 4),
  829. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  830. makeSquare(UDim2.new(0, 0, 0, 406), UDim2.new(0, 342, 0, 4),
  831. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  832. makeSquare(UDim2.new(0, 342, 0, 404), UDim2.new(0, 2, 0, 4),
  833. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  834. makeSquare(UDim2.new(0, -4, 0, 404), UDim2.new(0, 2, 0, 2),
  835. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  836. makeSquare(UDim2.new(0, -2, 0, 406), UDim2.new(0, 2, 0, 2),
  837. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  838. makeSquare(UDim2.new(0, -6, 0, -2), UDim2.new(0, 2, 0, 406),
  839. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  840. local text = makeSquare(UDim2.new(0, 4, 0, 8), UDim2.new(0, 0, 0, 0), Color3.new(0/255, 0/255, 0/255), 1, creativeInv, 3)
  841. text.Text = "Creative Inventory"
  842. text.Font = "SourceSansSemibold"
  843. text.TextSize = 14
  844. text.TextXAlignment = "Left"
  845. --
  846. local draggingBlockPicture = Instance.new("ImageLabel", invGui)
  847. draggingBlockPicture.BackgroundTransparency = 1
  848. draggingBlockPicture.Size = UDim2.new(0, 32, 0, 32)
  849. draggingBlockPicture.ZIndex = 5
  850. coroutine.resume(coroutine.create(function()
  851. local invMouse = player:GetMouse()
  852. --local RS = game:GetService("RunService").RenderStepped
  853. invMouse.Button2Down:connect(function()
  854. draggingBlock = nil
  855. end)
  856. while RS:wait() do
  857. draggingBlockPicture.Position = UDim2.new(0, invMouse.X - 16, 0, invMouse.Y - 16)
  858. if draggingBlock ~= nil then
  859. draggingBlockPicture.Image = draggingBlock.frontTex
  860. else
  861. draggingBlockPicture.Image = ""
  862. end
  863. end
  864. end))
  865.  
  866. local done = false
  867. local x = 0
  868. local y = 0
  869.  
  870. for i,b in pairs(creativeInventory) do
  871. putInventorySlot(UDim2.new(0.5, (x*36) + 8, 0.5, (y*36) + 28), b.frontTex, creativeInv, 4).MouseButton1Down:connect(function()
  872. if draggingBlock == nil then
  873. draggingBlock = b
  874. end
  875. end)
  876. x = x + 1
  877. if x >= 8 then
  878. x = 0
  879. y = y + 1
  880. end
  881. end
  882. if x == 0 then done = true end
  883. while x < 8 and done == false do
  884. putInventorySlot(UDim2.new(0.5, (x*36) + 8, 0.5, (y*36) + 28), "", creativeInv, 4)
  885. x = x + 1
  886. end
  887. for i = 1, 9 do
  888. if toolBar[i] ~= nil then
  889. local invSlot = putInventorySlot(UDim2.new(0, 8 + ((i-1)*36), 0, 360), toolBar[i].frontTex, creativeInv, 4)
  890. invSlot.MouseButton2Down:connect(function()
  891. local imgLabel = invSlot:FindFirstChild("ImageLabel")
  892. if imgLabel then
  893. toolBar[i] = nil
  894. imgLabel.Image = ""
  895. end
  896. end)
  897. invSlot.MouseButton1Down:connect(function()
  898. --updateHand = true
  899. local imgLabel = invSlot:FindFirstChild("ImageLabel")
  900. if toolBar[i] == nil then
  901. toolBar[i] = draggingBlock
  902. imgLabel.Image = draggingBlock.frontTex
  903. draggingBlock = nil
  904. return
  905. end
  906. if toolBar[i] ~= nil and draggingBlock == nil then
  907. draggingBlock = toolBar[i]
  908. toolBar[i] = nil
  909. imgLabel.Image = ""
  910. return
  911. elseif toolBar[i] ~= nil and draggingBlock ~= nil then
  912. --draggingBlock = toolBar[i]
  913. --toolBar[i] = nil
  914. imgLabel.Image = ""
  915. local temp = toolBar[i]
  916. toolBar[i] = draggingBlock
  917. if imgLabel and draggingBlock ~= nil then
  918. imgLabel.Image = draggingBlock.frontTex
  919. end
  920. if imgLabel and draggingBlock == nil then
  921. imgLabel.Image = ""
  922. end
  923. draggingBlock = temp
  924. return
  925. end
  926. end)
  927. else
  928. local invSlot = putInventorySlot(UDim2.new(0, 8 + ((i-1)*36), 0, 360), "", creativeInv, 4)
  929. invSlot.MouseButton2Down:connect(function()
  930. local imgLabel = invSlot:FindFirstChild("ImageLabel")
  931. if imgLabel then
  932. toolBar[i] = nil
  933. imgLabel.Image = ""
  934. end
  935. end)
  936. invSlot.MouseButton1Down:connect(function()
  937. --updateHand = true
  938. local imgLabel = invSlot:FindFirstChild("ImageLabel")
  939. if toolBar[i] == nil then
  940. toolBar[i] = draggingBlock
  941. imgLabel.Image = draggingBlock.frontTex
  942. draggingBlock = nil
  943. return
  944. end
  945. if toolBar[i] ~= nil and draggingBlock == nil then
  946. draggingBlock = toolBar[i]
  947. toolBar[i] = nil
  948. imgLabel.Image = ""
  949. return
  950. elseif toolBar[i] ~= nil and draggingBlock ~= nil then
  951. --draggingBlock = toolBar[i]
  952. --toolBar[i] = nil
  953. imgLabel.Image = ""
  954. local temp = toolBar[i]
  955. toolBar[i] = draggingBlock
  956. if imgLabel and draggingBlock ~= nil then
  957. imgLabel.Image = draggingBlock.frontTex
  958. end
  959. if imgLabel and draggingBlock == nil then
  960. imgLabel.Image = ""
  961. end
  962. draggingBlock = temp
  963. return
  964. end
  965. end)
  966. end
  967. end
  968. return creativeInv
  969. end
  970. end
  971. function putToolBarSlot(position, image, zindex)
  972. local playerGui = player:FindFirstChild("PlayerGui")
  973. if playerGui then
  974. local gui = playerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", playerGui)
  975. gui.Name = "ToolBar"
  976. local slot = Instance.new("ImageLabel", gui)
  977. slot.Position = position
  978. slot.Size = UDim2.new(0, 32, 0, 32)
  979. slot.BackgroundTransparency = 1
  980. slot.ImageTransparency = 0
  981. slot.Image = image
  982. slot.ZIndex = 2
  983.  
  984. makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 32, 0, 32),
  985. Color3.new(95/255, 89/255, 76/255), 0, slot)
  986. makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 2, 0, 32),
  987. Color3.new(0/255, 0/255, 0/255), 0.5, slot)
  988. makeSquare(UDim2.new(0, 2, 0, 0), UDim2.new(0, 30, 0, 2),
  989. Color3.new(0/255, 0/255, 0/255), 0.5, slot)
  990. makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 36, 0, 2),
  991. Color3.new(106/255, 106/255, 106/255), 0, slot)
  992. makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 2, 0, 36),
  993. Color3.new(106/255, 106/255, 106/255), 0, slot)
  994. makeSquare(UDim2.new(0, 0, 0, 32), UDim2.new(0, 34, 0, 2),
  995. Color3.new(130/255, 130/255, 130/255), 0, slot)
  996. makeSquare(UDim2.new(0, 32, 0, 0), UDim2.new(0, 2, 0, 34),
  997. Color3.new(130/255, 130/255, 130/255), 0, slot)
  998. makeSquare(UDim2.new(0, -4, 0, -2), UDim2.new(0, 2, 0, 38),
  999. Color3.new(130/255, 130/255, 130/255), 0, slot)
  1000. makeSquare(UDim2.new(0, 34, 0, -2), UDim2.new(0, 2, 0, 36),
  1001. Color3.new(106/255, 106/255, 106/255), 0, slot)
  1002. makeSquare(UDim2.new(0, -2, 0, 34), UDim2.new(0, 38, 0, 2),
  1003. Color3.new(106/255, 106/255, 106/255), 0, slot)
  1004. makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 40, 0, 2),
  1005. Color3.new(156/255, 156/255, 156/255), 0, slot)
  1006. return slot
  1007. end
  1008. end
  1009. function divide(x, d)
  1010. if x ~= 0 and d ~= 0 then
  1011. return x/d
  1012. else
  1013. return x
  1014. end
  1015. end -- so it doesn't divide by zero
  1016. function getDistance(v1, v2)
  1017. return math.abs((Vector3.new(math.abs(v2.X - v1.X), math.abs(v2.Y - v1.Y), math.abs(v2.Z - v1.Z))).Magnitude)
  1018. end
  1019. function round(x)
  1020. if x%2 ~= 0.5 then
  1021. return math.floor(x+0.5)
  1022. end
  1023. return x-0.5
  1024. end
  1025. function weldTo(part1, part2)
  1026. local weld = Instance.new("Weld", part1)
  1027. weld.Part0 = part1
  1028. weld.Part1 = part2
  1029. end
  1030. function getMagnitudeXZ(velocity)
  1031. return math.sqrt(math.abs(velocity.X)^2 + math.abs(velocity.Z)^2)
  1032. end
  1033. function findHumanoid(inst)
  1034. local find = inst
  1035. local hum = nil
  1036. repeat
  1037. if find.Name == "Workspace" then return nil end
  1038. find = find.Parent
  1039. hum = find:FindFirstChild("Humanoid")
  1040. until hum
  1041. --if hum then print("found!!") else print("aw... not found") end
  1042. --if hum.ClassName ~= "Humanoid" then hum = nil end
  1043. return hum
  1044. end
  1045. function placeBlock(block, cFPos, Mouse)
  1046. if block == nil then
  1047. if Mouse.Target.Size.X <= 10 and Mouse.Target.Size.Y <= 10 and Mouse.Target.Size.Z <= 10 and Mouse.Target then
  1048. if Mouse.Target.Parent.Name ~= "Camera" then
  1049. --print(Mouse.Target:GetFullName())
  1050. local blkTar = Mouse.Target
  1051. --Mouse.Target.Parent = nil
  1052. for i = 1, 9 do
  1053. local part = Instance.new("Part", workspace)
  1054. part.Size = Vector3.new(0, 0, 0)
  1055. part.Transparency = 1
  1056. part.CanCollide = false
  1057. part.Velocity = Vector3.new(math.random(-5, 5), 5, math.random(-5, 5))
  1058. part.Name = "Debris"
  1059.  
  1060. part.CFrame =
  1061. Mouse.Target.CFrame *
  1062. CFrame.new(math.random(-blkTar.Size.X/2, blkTar.Size.X/2), math.random(-blkTar.Size.Y/2, blkTar.Size.Y/2), math.random(-blkTar.Size.Z/2, blkTar.Size.Z/2))
  1063.  
  1064. local billboard = Instance.new("BillboardGui", part)
  1065. billboard.Size = UDim2.new(1.2, 0, 1.2, 0)
  1066.  
  1067. local clipDescendant = Instance.new("TextLabel", billboard)
  1068. clipDescendant.Size = UDim2.new(0.5, 0, 0.5, 0)
  1069. clipDescendant.BackgroundTransparency = 1
  1070. clipDescendant.Text = ""
  1071. clipDescendant.ClipsDescendants = true
  1072.  
  1073. local img = Instance.new("ImageLabel", clipDescendant)
  1074. img.Size = UDim2.new(2, 0, 2, 0)
  1075. img.BackgroundTransparency = 1
  1076. img.Position = UDim2.new((math.random(0, 100)-50)/100, 0, (math.random(0, 100)-50)/100, 0)
  1077.  
  1078. local tex = blkTar:FindFirstChild("Front")
  1079. if tex then
  1080. img.Image = tex.Texture
  1081. else
  1082. img.Image = "rbxassetid://744949545"
  1083. end
  1084.  
  1085. if img.Image == "rbxassetid://744949545" then
  1086. img.ImageColor3 = blkTar.Color
  1087. end
  1088.  
  1089. part.Touched:connect(function(prt)
  1090. if prt ~= blkTar then
  1091. part.CanCollide = true
  1092. end
  1093. end)
  1094.  
  1095. coroutine.resume(coroutine.create(function()
  1096. wait(math.random(50, 65)/100)
  1097. part:Destroy()
  1098. end))
  1099. --part.Anchored = false
  1100. end
  1101. blkTar:Destroy()
  1102. end
  1103. end
  1104. return nil
  1105. else
  1106. local blockPlaced = Instance.new("Part", workspace)
  1107. blockPlaced.Material = "Fabric"
  1108. blockPlaced.Transparency = block.transparency
  1109. blockPlaced.Anchored = true
  1110. blockPlaced.Size = block.size
  1111. blockPlaced.CFrame = cFPos
  1112. blockPlaced.Name = block.name
  1113. putTexture(blockPlaced, block.frontTex, block.backTex,
  1114. block.topTex, block.bottomTex, block.leftTex, block.rightTex, "Texture")
  1115.  
  1116. if block.hasGravity == true then
  1117. local connectedTo = Instance.new("ObjectValue", blockPlaced)
  1118. connectedTo.Name = "ConnectedTo"
  1119. blockPlaced.Anchored = false
  1120. blockPlaced.CanCollide = false
  1121. local detector = Instance.new("Part", workspace:WaitForChild("Camera"))
  1122. detector.Transparency = 1
  1123. detector.CanCollide = false
  1124. detector.Size = Vector3.new(1, 0, 1)
  1125. local weldDetector = Instance.new("Motor6D", detector)
  1126. weldDetector.Part0 = detector
  1127. weldDetector.Part1 = blockPlaced
  1128. weldDetector.C1 = CFrame.new(0, -blockPlaced.Size.Y/2, 0)
  1129. local landed = false
  1130. local function fallingBlock()
  1131. coroutine.resume(coroutine.create(function()
  1132. local falling = Instance.new("CFrameValue", blockPlaced)
  1133. falling.Name = "IsFalling"
  1134. local grav = 0
  1135. while RS:wait() do
  1136. if landed then falling:Destroy() break end
  1137. grav = math.max(-1, grav - 0.0025)
  1138. blockPlaced.CFrame = CFrame.new(cFPos.X, blockPlaced.CFrame.Y + grav, cFPos.Z)
  1139. end
  1140. end))
  1141. end
  1142. fallingBlock()
  1143. detector.Touched:connect(function(part)
  1144. if blockPlaced.Anchored == false and part ~= blockPlaced and part.Name ~= "Debris" and part:FindFirstChild("IsFalling") == nil and findHumanoid(part) == nil then
  1145. landed = true
  1146. blockPlaced.CanCollide = true
  1147. blockPlaced.Velocity = Vector3.new(0, 0, 0)
  1148. blockPlaced.Anchored = true
  1149. connectedTo.Value = part
  1150. local yOrigin = part.CFrame.Y + (blockPlaced.Size.Y/2) + (part.Size.Y/2)
  1151. blockPlaced.CFrame = CFrame.new(cFPos.X, yOrigin, cFPos.Z)
  1152. --detector:Destroy()
  1153. local falling = false
  1154. part.Changed:connect(function()
  1155. if part.Position.Y ~= yOrigin and falling == false then
  1156. falling = true
  1157. wait(0.075)
  1158. landed = false
  1159. blockPlaced.Anchored = false
  1160. blockPlaced.CanCollide = false
  1161. blockPlaced.Velocity = Vector3.new(0, 0, 0)
  1162. fallingBlock()
  1163. falling = false
  1164. end
  1165. end)
  1166. workspace.ChildRemoved:connect(function()
  1167. --print("hi")
  1168. if connectedTo.Value.Parent == nil and falling == false then
  1169. falling = true
  1170. landed = false
  1171. blockPlaced.Anchored = false
  1172. blockPlaced.CanCollide = false
  1173. blockPlaced.Velocity = Vector3.new(0, 0, 0)
  1174. fallingBlock()
  1175. end
  1176. end)
  1177. end
  1178. end)
  1179. end
  1180.  
  1181. local blockSound = Instance.new("Sound", blockPlaced)
  1182. blockSound.SoundId = block.sound
  1183. blockSound.Volume = block.soundVol
  1184. blockSound.Pitch = math.random(95, 105)/100
  1185. blockSound.PlayOnRemove = true
  1186. blockSound:Play()
  1187. return blockPlaced
  1188. end
  1189. end
  1190. if player then
  1191. local char = player.Character
  1192. if char then
  1193. for _,cM in pairs(char:GetChildren()) do
  1194. if cM.ClassName == "CharacterMesh" then cM:Destroy() end
  1195. end
  1196.  
  1197. --[]
  1198. local gui = player.PlayerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", player.PlayerGui)
  1199. gui.Name = "ToolBar"
  1200.  
  1201. makeSquare(UDim2.new(0.5, -166, 1, -111), UDim2.new(0, 364, 0, 44),
  1202. Color3.new(0/255, 0/255, 0/255), 0, gui)
  1203.  
  1204. for i = 1, 9 do
  1205. if toolBar[i] ~= nil then
  1206. local img = putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), toolBar[i].frontTex)
  1207. coroutine.resume(coroutine.create(function()
  1208. while wait() do
  1209. if toolBar[i] ~= nil then
  1210. img.Image = toolBar[i].frontTex
  1211. else
  1212. img.Image = ""
  1213. end
  1214. end
  1215. end))
  1216. else
  1217. local img = putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), "")
  1218. coroutine.resume(coroutine.create(function()
  1219. while wait() do
  1220. if toolBar[i] ~= nil then
  1221. img.Image = toolBar[i].frontTex
  1222. else
  1223. img.Image = ""
  1224. end
  1225. end
  1226. end))
  1227. end
  1228. end
  1229.  
  1230. local creativeInventoryGUI = makeInventory()
  1231.  
  1232. local humRootPart = char:WaitForChild("HumanoidRootPart")
  1233. local head = char:WaitForChild("Head")
  1234. local torso = char:WaitForChild("Torso")
  1235. local lArm = char:WaitForChild("Left Arm")
  1236. local rArm = char:WaitForChild("Right Arm")
  1237. local lLeg = char:WaitForChild("Left Leg")
  1238. local rLeg = char:WaitForChild("Right Leg")
  1239.  
  1240. local humanoid = char:WaitForChild("Humanoid")
  1241. char.Humanoid:ClearAllChildren()
  1242. humanoid.HipHeight = 0.3
  1243. humanoid.AutoRotate = false
  1244.  
  1245. humanoid.Parent = nil
  1246.  
  1247. if char:FindFirstChild("Animate") then
  1248. char.Animate:Remove()
  1249. end
  1250.  
  1251. head.Size = Vector3.new(1.3, 1.3, 1.3)
  1252. putTexture(head, "rbxassetid://38738031", "rbxassetid://36047330",
  1253. "rbxassetid://36047341", "rbxassetid://36047347",
  1254. "rbxassetid://36047323", "rbxassetid://36047315", "Decal")
  1255. head:WaitForChild("Mesh"):Destroy()
  1256. head:WaitForChild("face"):Destroy()
  1257.  
  1258. torso.Size = Vector3.new(1.3, 1.95, 0.65)
  1259. putTexture(torso, "rbxassetid://38934753", "rbxassetid://38934731",
  1260. "rbxassetid://38934780", "rbxassetid://38934740",
  1261. "rbxassetid://38934762", "rbxassetid://38934762", "Decal")
  1262.  
  1263. lArm.Size = Vector3.new(0.65, 1.95, 0.65)
  1264. putTexture(lArm, "rbxassetid://38934581", "rbxassetid://38934560",
  1265. "rbxassetid://38934613", "rbxassetid://38934568",
  1266. "rbxassetid://38934601", "rbxassetid://38934591", "Decal")
  1267.  
  1268. rArm.Size = Vector3.new(0.65, 1.95, 0.65)
  1269. putTexture(rArm, "rbxassetid://38934560", "rbxassetid://38934581",
  1270. "rbxassetid://38934613", "rbxassetid://38934568",
  1271. "rbxassetid://38934601", "rbxassetid://38934591", "Decal")
  1272.  
  1273. lLeg.Size = Vector3.new(0.65, 1.95, 0.65)
  1274. putTexture(lLeg, "rbxassetid://38936226", "rbxassetid://38936209",
  1275. "rbxassetid://38934719", "rbxassetid://38934712",
  1276. "rbxassetid://38936255", "rbxassetid://38936242", "Decal")
  1277.  
  1278. rLeg.Size = Vector3.new(0.65, 1.95, 0.65)
  1279. putTexture(rLeg, "rbxassetid://38936209", "rbxassetid://38936226",
  1280. "rbxassetid://38934719", "rbxassetid://38934712",
  1281. "rbxassetid://38936242", "rbxassetid://38936255", "Decal")
  1282.  
  1283. -- now for the real stuff
  1284. -- |
  1285. -- |
  1286. -- V
  1287. Instance.new("BlockMesh", torso)
  1288. Instance.new("BlockMesh", lArm)
  1289. Instance.new("BlockMesh", rArm)
  1290. Instance.new("BlockMesh", lLeg)
  1291. Instance.new("BlockMesh", rLeg)
  1292.  
  1293. local camera = workspace.Camera
  1294.  
  1295. local camPart = Instance.new("Part", camera)
  1296. camPart.Size = Vector3.new(0, 0, 0)
  1297. camPart.CFrame = camera.CFrame
  1298. camPart.CanCollide = false
  1299. camPart.Anchored = true
  1300. camPart.Transparency = 1
  1301.  
  1302. local cameraHand = Instance.new("Part", camera)
  1303. cameraHand.Size = Vector3.new(0.65, 1.95, 0.65)
  1304. cameraHand.CanCollide = false
  1305. cameraHand.Anchored = true
  1306. cameraHand.Name = "CameraHand"
  1307. putTexture(cameraHand, "rbxassetid://38934560", "rbxassetid://38934581",
  1308. "rbxassetid://38934613", "rbxassetid://38934568",
  1309. "rbxassetid://38934601", "rbxassetid://38934591", "Decal")
  1310.  
  1311. local cameraHandItem = Instance.new("Part", camera)
  1312. cameraHandItem.Name = "CameraHandItem"
  1313. cameraHandItem.Size = Vector3.new(1.1, 1.1, 1.1)
  1314. cameraHandItem.Anchored = true
  1315. cameraHandItem.CanCollide = false
  1316. cameraHandItem.Transparency = 1
  1317.  
  1318. -- welding doesn't really work.
  1319. --local cameraHandWeld = Instance.new("Motor6D", camPart)
  1320. --cameraHandWeld.Part0 = camPart
  1321. --cameraHandWeld.Part1 = cameraHand
  1322. --cameraHandWeld.C0 = CFrame.new(5, 0, 0)
  1323.  
  1324. local rootJoint = torso:FindFirstChild("RootJoint") or Instance.new("Motor6D", torso)
  1325. rootJoint.Name = "RootJoint"
  1326. rootJoint.Part0 = humRootPart
  1327. rootJoint.Part1 = torso
  1328. rootJoint.C1 = CFrame.new(0, 0.05, 0)
  1329.  
  1330. local neck = torso:FindFirstChild("Neck") or Instance.new("Motor6D", torso)
  1331. neck.Name = "Neck"
  1332. neck.Part0 = head
  1333. neck.Part1 = torso
  1334.  
  1335. local lS = torso:FindFirstChild("Left Shoulder") or Instance.new("Motor6D", torso)
  1336. lS.Name = "Left Shoulder"
  1337. lS.Part0 = lArm
  1338. lS.Part1 = torso
  1339. lS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
  1340. lS.C1 = CFrame.new(0.65, 0.975, 0)
  1341.  
  1342. local rS = torso:FindFirstChild("Right Shoulder") or Instance.new("Motor6D", torso)
  1343. rS.Name = "Right Shoulder"
  1344. rS.Part0 = rArm
  1345. rS.Part1 = torso
  1346. rS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
  1347. rS.C1 = CFrame.new(-0.65, 0.975, 0) * CFrame.Angles(0, -math.rad(180), 0)
  1348.  
  1349. local lH = torso:FindFirstChild("Left Hip") or Instance.new("Motor6D", torso)
  1350. lH.Name = "Left Hip"
  1351. lH.Part0 = lLeg
  1352. lH.Part1 = torso
  1353. lH.C0 = CFrame.new(0, 0.975, 0)
  1354. lH.C1 = CFrame.new(0.325, -0.975, 0) * CFrame.Angles(0, 0, 0)
  1355.  
  1356. local rH = torso:FindFirstChild("Right Hip") or Instance.new("Motor6D", torso)
  1357. rH.Name = "Right Hip"
  1358. rH.Part0 = rLeg
  1359. rH.Part1 = torso
  1360. rH.C0 = CFrame.new(0, 0.975, 0)
  1361. rH.C1 = CFrame.new(-0.325, -0.975, 0) * CFrame.Angles(0, -math.rad(180), 0)
  1362.  
  1363. for _,p in pairs(char:GetChildren()) do
  1364. if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
  1365. local hit = Instance.new("Part", char)
  1366. hit.Name = "DamagePart"
  1367. hit.BrickColor = BrickColor.new("Bright red")
  1368. hit.Material = "SmoothPlastic"
  1369. hit.Transparency = 1
  1370. hit.Size = Vector3.new(p.Size.X + 0.05, p.Size.Y + 0.05, p.Size.Z + 0.05)
  1371. hit.CanCollide = false
  1372. weldTo(hit, p)
  1373. end
  1374. end
  1375.  
  1376. wait(0.25)
  1377.  
  1378. -- local billNameTag = Instance.new("BillboardGui", char)
  1379. -- billNameTag.Size = UDim2.new(1, 0, 1, 0)
  1380. -- billNameTag.Adornee = head
  1381. -- billNameTag.PlayerToHideFrom = player
  1382. --
  1383. -- local textLabel = Instance.new("TextLabel", billNameTag)
  1384. -- textLabel.Font = "Arcade"
  1385. -- --textLabel.Size = UDim2.new(1, 0, 1, 0)
  1386. -- textLabel.TextScaled = true
  1387. -- --textLabel.TextSize = 100
  1388. -- textLabel.Text = targetName
  1389. -- textLabel.Size = UDim2.new(textLabel.TextBounds.X/100, 0, 0.75, 0)
  1390. -- textLabel.BorderSizePixel = 0
  1391. -- textLabel.BackgroundColor3 = Color3.new(0, 0, 0)
  1392. -- textLabel.TextColor3 = Color3.new(1, 1, 1)
  1393. -- textLabel.BackgroundTransparency = 0.5
  1394. --
  1395. -- if textLabel.Text == "Depr1" then
  1396. -- textLabel.TextColor3 = Color3.new(1, 0.75, 0)
  1397. -- end
  1398. --
  1399. -- billNameTag.SizeOffset = Vector2.new(-textLabel.TextBounds.X/200 + 0.5, 0)
  1400. -- billNameTag.StudsOffset = Vector3.new(0, 1.5, 0)
  1401.  
  1402.  
  1403. humanoid.Parent = char
  1404.  
  1405. local ticks = 0
  1406. local times = 0
  1407.  
  1408. local walkAnim = 0
  1409. local increaseWalkAnim = 1
  1410.  
  1411. local idleAnimRotX = 0
  1412. local idleAnimRotZ = 0
  1413. local sneaking = 0
  1414.  
  1415. --local RS = game:GetService("RunService").RenderStepped
  1416. local Mouse = player:GetMouse()
  1417.  
  1418. local oldHP = humanoid.Health
  1419. local damageTime = 0
  1420.  
  1421. local punchRotX = 0
  1422. local punchRotY = 0
  1423. local punchRotZ = 0
  1424. local punchRotXcam = 0
  1425. local punchRotYcam = 0
  1426. local punchRotZcam = 0
  1427. local punchSpeed = 0
  1428. local punching = 0
  1429. local selectedBlock = 8
  1430. local punchEnded = 1
  1431. local itemOnHand = nil
  1432.  
  1433. local selectBox = Instance.new("SelectionBox", camera)
  1434. selectBox.Transparency = 0.5
  1435. selectBox.Color3 = Color3.new(0, 0, 0)
  1436. selectBox.LineThickness = 0
  1437.  
  1438. local handItem = Instance.new("Part", char)
  1439. handItem.Name = "HandItem"
  1440. handItem.Size = Vector3.new(0.52, 0.52, 0.52)
  1441. handItem.Transparency = 1
  1442. handItem.CanCollide = false
  1443.  
  1444. local handItemWeld = Instance.new("Weld", char)
  1445. handItemWeld.Part0 = handItem
  1446. handItemWeld.Part1 = lArm
  1447. handItemWeld.C1 = CFrame.new(0, -0.9, -0.6) * CFrame.Angles(math.rad(-10), math.rad(45), 0)
  1448.  
  1449. local sound = Instance.new("Sound", char)
  1450. sound.Name = "Hurt"
  1451. sound.Volume = 10
  1452. sound.SoundId = "rbxassetid://535690488"
  1453.  
  1454. local facesToResize = {"Front", "Back", "Left", "Right", "Bottom", "Top"}
  1455.  
  1456. local camCurrentZoom = (camera.CFrame.p - head.Position).magnitude
  1457. Mouse.Button1Down:connect(function()
  1458. if punchEnded == 1 then punching = 1 end
  1459. if Mouse.Target then
  1460. if getDistance(head.CFrame.p, Mouse.Hit.p) <= 10.4 then
  1461. local humanoid = Mouse.Target.Parent:FindFirstChild("Humanoid")
  1462. if humanoid then
  1463. humanoid.Health = humanoid.Health - 10
  1464. local parts = Mouse.Target.Parent:GetChildren()
  1465. for _,p in pairs(parts) do
  1466. if p.ClassName == "Part" then
  1467. p.Velocity = Vector3.new(p.Velocity.X + (head.CFrame.lookVector.X * 18), p.Velocity.Y + (head.CFrame.lookVector.Y * 18) + 8, p.Velocity.Z + (head.CFrame.lookVector.Z * 18))
  1468. end
  1469. end
  1470. return
  1471. end
  1472. local x = Mouse.Target.CFrame.p.X
  1473. local y = Mouse.Target.CFrame.p.Y
  1474. local z = Mouse.Target.CFrame.p.Z
  1475. if Mouse.TargetSurface.Name == "Right" then x = x + 2.6 end
  1476. if Mouse.TargetSurface.Name == "Left" then x = x - 2.6 end
  1477. if Mouse.TargetSurface.Name == "Top" then y = y + 2.6 end
  1478. if Mouse.TargetSurface.Name == "Bottom" then y = y - 2.6 end
  1479. if Mouse.TargetSurface.Name == "Back" then z = z + 2.6 end
  1480. if Mouse.TargetSurface.Name == "Front" then z = z - 2.6 end
  1481. if Mouse.Target.Size.X > 2.6 or Mouse.Target.Size.Y > 2.6 or Mouse.Target.Size.Z > 2.6 then
  1482. x = Mouse.Hit.p.X
  1483. y = Mouse.Hit.p.Y
  1484. z = Mouse.Hit.p.Z
  1485. end
  1486. -- local x = round(math.abs(mouseX)/2.6)*2.6
  1487. -- local y = round(math.abs(mouseY)/2.6)*2.6
  1488. -- local z = round(math.abs(mouseZ)/2.6)*2.6
  1489. -- if Mouse.Hit.p.X < 0 then x = x * -1 end
  1490. -- if Mouse.Hit.p.Y < 0 then y = y * -1 end
  1491. -- if Mouse.Hit.p.Z < 0 then z = z * -1 end
  1492. local blk = placeBlock(toolBar[selectedBlock + 1], CFrame.new(x, y, z), Mouse)
  1493. if blk then
  1494. for _,f in pairs(facesToResize) do
  1495. blk:WaitForChild(f).StudsPerTileU = 2.6
  1496. blk:WaitForChild(f).StudsPerTileV = 2.6
  1497. end
  1498. end
  1499. end
  1500. end
  1501. end)
  1502.  
  1503. local changedItem = false
  1504. local hasItemOnHand = 0
  1505. local hi = 0
  1506. -- selection thingy
  1507. local selectLabel = Instance.new("TextLabel", gui)
  1508. selectLabel.Size = UDim2.new(0, 32, 0, 32)
  1509. selectLabel.Position = UDim2.new(0.5, -160 + (selectedBlock*40), 1, -105)
  1510. selectLabel.BackgroundTransparency = 0.5
  1511. selectLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  1512. selectLabel.BorderSizePixel = 0
  1513. selectLabel.Text = ""
  1514. selectLabel.ZIndex = 3
  1515. --
  1516. local oldItemOnHand = itemOnHand
  1517. function updateItemOnHand()
  1518. for _,d in pairs(handItem:GetChildren()) do
  1519. d:Destroy()
  1520. end
  1521. for _,d in pairs(cameraHandItem:GetChildren()) do
  1522. d:Destroy()
  1523. end
  1524. if itemOnHand ~= nil then
  1525. putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
  1526. itemOnHand.topTex, itemOnHand.bottomTex,
  1527. itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
  1528.  
  1529. putTexture(cameraHandItem, itemOnHand.frontTex, itemOnHand.backTex,
  1530. itemOnHand.topTex, itemOnHand.bottomTex,
  1531. itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
  1532.  
  1533. for _,f in pairs(facesToResize) do
  1534. handItem:WaitForChild(f).StudsPerTileU = 0.52
  1535. handItem:WaitForChild(f).StudsPerTileV = 0.52
  1536. end
  1537.  
  1538. for _,f in pairs(facesToResize) do
  1539. cameraHandItem:WaitForChild(f).StudsPerTileU = 1.1
  1540. cameraHandItem:WaitForChild(f).StudsPerTileV = 1.1
  1541. end
  1542.  
  1543. cameraHand.Transparency = 1
  1544. for _,f in pairs(facesToResize) do
  1545. cameraHand:WaitForChild(f).Transparency = 1
  1546. cameraHand:WaitForChild(f).Transparency = 1
  1547. end
  1548. else
  1549. cameraHand.Transparency = 0
  1550. for _,f in pairs(facesToResize) do
  1551. cameraHand:WaitForChild(f).Transparency = 0
  1552. cameraHand:WaitForChild(f).Transparency = 0
  1553. end
  1554. end
  1555. if oldItemOnHand ~= itemOnHand then
  1556. changedItem = true
  1557. end
  1558. end
  1559.  
  1560. local pressedWTimes = 0
  1561. local sprintingNum = 0
  1562. local sprinting = false
  1563. Mouse.KeyDown:connect(function(key)
  1564. if sprinting == false then sprintingNum = 0 else sprintingNum = 1 end
  1565. if (key == "w" and sprinting == false and sneaking == 0) then
  1566. if pressedWTimes >= 1 or key == Enum.KeyCode.LeftControl then
  1567. sprinting = true
  1568. humanoid.WalkSpeed = humanoid.WalkSpeed * 1.5
  1569. pressedWTimes = 0
  1570. coroutine.resume(coroutine.create(function()
  1571. for i = 1, 24 do
  1572. camera.FieldOfView = camera.FieldOfView + ((24-i)/10)
  1573. RS:wait()
  1574. end
  1575. end))
  1576. end
  1577. pressedWTimes = pressedWTimes + 1
  1578. coroutine.resume(coroutine.create(function()
  1579. for i = 1, 9 do
  1580. if sprinting == true then break end
  1581. wait()
  1582. end
  1583. pressedWTimes = 0
  1584. end))
  1585. end
  1586. if key == "q" and sprinting == false then
  1587. sneaking = 1
  1588. humanoid.WalkSpeed = humanoid.WalkSpeed / 2
  1589. humanoid.HipHeight = humanoid.HipHeight - 0.35
  1590. rootJoint.C1 = CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
  1591. lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0)
  1592. rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
  1593. --print("Sneaking...")
  1594. end
  1595. if key == "e" then
  1596. if creativeInventoryGUI.Visible == true then
  1597. creativeInventoryGUI.Visible = false
  1598. elseif creativeInventoryGUI.Visible == false then
  1599. creativeInventoryGUI.Visible = true
  1600. end
  1601. end
  1602. if key == "1" or key == "2" or key == "3" or
  1603. key == "4" or key == "5" or key == "6" or
  1604. key == "7" or key == "8" or key == "9" then
  1605. selectedBlock = tonumber(key) - 1
  1606. oldItemOnHand = itemOnHand
  1607. itemOnHand = toolBar[tonumber(key)]
  1608. updateItemOnHand()
  1609. if hasItemOnHand == 0 and itemOnHand then hi = 1 end
  1610. if hasItemOnHand == 1 and itemOnHand == nil then hi = 1 end
  1611. end
  1612. --if (key == "0" or key == "1" or key == "2"
  1613. -- or key == "3" or key == "4" or key == "5"
  1614. -- or key == "6" or key == "7") and hasItemOnHand == 0 then hi = 1 end
  1615. selectLabel.Position = UDim2.new(0.5, -160 + ((selectedBlock)*40), 1, -105)
  1616. end)
  1617.  
  1618. local changedPerspective = 0
  1619. Mouse.KeyUp:connect(function(key)
  1620. if sprinting == false then sprintingNum = 0 else sprintingNum = 1 end
  1621. if (key == "w" and sprinting == true and sneaking == 0) then
  1622. sprinting = false
  1623. humanoid.WalkSpeed = humanoid.WalkSpeed / 1.5
  1624. coroutine.resume(coroutine.create(function()
  1625. for i = 1, 24 do
  1626. camera.FieldOfView = camera.FieldOfView - ((24-i)/10)
  1627. RS:wait()
  1628. end
  1629. end))
  1630. end
  1631. if key == "q" and sprinting == false then
  1632. sneaking = 0
  1633. humanoid.WalkSpeed = humanoid.WalkSpeed * 2
  1634. humanoid.HipHeight = humanoid.HipHeight + 0.35
  1635. rootJoint.C1 = CFrame.new(0, 0.05, 0) * CFrame.Angles(0, 0, 0)
  1636. lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0)
  1637. rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0)
  1638. --print("Stopped sneaking...")
  1639. end
  1640. if key == "r" then
  1641. if changedPerspective == 0 then
  1642. changedPerspective = 1
  1643. camera.CFrame = camera.CFrame * CFrame.Angles(0, math.rad(180), 0)
  1644. elseif changedPerspective == 1 then
  1645. changedPerspective = 0
  1646. camera.CFrame = camera.CFrame * CFrame.Angles(0, math.rad(-180), 0)
  1647. end
  1648. end
  1649. end)
  1650.  
  1651. Mouse.TargetFilter = camera
  1652.  
  1653. local humOffset = CFrame.new(0, 0, 0)
  1654. local camHandY = 0
  1655. local cameraHandCFrame = CFrame.new(1.15, -1.35, -2) * CFrame.fromEulerAnglesXYZ(math.rad(90), math.rad(55), math.rad(20))
  1656. local bodyRot = CFrame.new(0, 0, 0)
  1657. while RS:wait() do
  1658. camCurrentZoom = ((CFrame.new(0, -1*sneaking, 0) * camera.CFrame).p - head.Position).magnitude
  1659. if itemOnHand ~= nil then
  1660. hasItemOnHand = 1
  1661. handItem.Transparency = itemOnHand.transparency
  1662. else
  1663. hasItemOnHand = 0
  1664. handItem.Transparency = 1
  1665. end
  1666. if humanoid.Health < oldHP then
  1667. damageTime = 60
  1668. sound:Play()
  1669. end
  1670. oldHP = humanoid.Health
  1671. if damageTime > 0 and humanoid.Health > 0 then
  1672. for _,p in pairs(char:GetChildren()) do
  1673. if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
  1674. if p.Name == "DamagePart" then
  1675. p.Transparency = 0.5
  1676. end
  1677. end
  1678. end
  1679. damageTime = damageTime - 2
  1680. if damageTime <= 0 then
  1681. for _,p in pairs(char:GetChildren()) do
  1682. if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
  1683. if p.Name == "DamagePart" then
  1684. p.Transparency = 1
  1685. end
  1686. end
  1687. end
  1688. end
  1689. end
  1690. camPart.CFrame = camera.CFrame * CFrame.Angles(0, math.rad(changedPerspective*180), 0)
  1691.  
  1692. if getMagnitudeXZ(torso.Velocity) > 1 then
  1693. if walkAnim >= 1 then
  1694. increaseWalkAnim = -1
  1695. elseif walkAnim <= -1 then
  1696. increaseWalkAnim = 1
  1697. end
  1698. walkAnim = walkAnim + (increaseWalkAnim/(10+(sneaking*20))) * ((5 + getMagnitudeXZ(torso.Velocity))/20)
  1699. else
  1700. walkAnim = 0
  1701. end
  1702.  
  1703. --lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0)
  1704. --rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
  1705. lH.C0 = lH.C0:lerp(CFrame.new(0, 0.975, 0) * CFrame.Angles(math.max(math.rad(-60), math.min(math.rad(60), -math.rad(sneaking*45) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)))), 0, 0), 0.15)
  1706. rH.C0 = rH.C0:lerp(CFrame.new(0, 0.975, 0) * CFrame.Angles(math.max(math.rad(-60), math.min(math.rad(60), math.rad(sneaking*45) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)))), 0, 0), 0.15)
  1707. --
  1708. --rootJoint.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
  1709. --print(math.abs(head.Orientation.Y) - math.abs(humRootPart.Orientation.Y))
  1710. --if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) > 45 then
  1711. --humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(-45 + head.Orientation.Y), 0)
  1712. --print("-45")
  1713. --end
  1714. --if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) < -45 then
  1715. --humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(45 + head.Orientation.Y), 0)
  1716. --print("45")
  1717. --end
  1718.  
  1719. if changedItem then
  1720. changedItem = false
  1721. coroutine.resume(coroutine.create(function()
  1722. for i = 1, 8 do
  1723. camHandY = camHandY - 0.2
  1724. RS:wait()
  1725. end
  1726. for i = 1, 8 do
  1727. camHandY = camHandY + 0.2
  1728. RS:wait()
  1729. end
  1730. end))
  1731. end
  1732.  
  1733. --move these arms
  1734. rootJoint.C1 = rootJoint.C1:lerp(CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), math.rad(punchRotY), 0), 0.2)
  1735.  
  1736. lS.C0 = lS.C0:lerp(CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(math.max(math.rad(-60), math.min(math.rad(60), idleAnimRotX/20 + math.rad(-hasItemOnHand*10) + math.rad(punchRotX) + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)))), 0, math.rad(punchRotZ) + idleAnimRotZ/20), 0.025+(math.min(1, getMagnitudeXZ(torso.Velocity))/12)*2 + divide(punchSpeed, 6) + hi)
  1737. rS.C0 = rS.C0:lerp(CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(math.max(math.rad(-60), math.min(math.rad(60), idleAnimRotX/20 + math.rad(damageTime*1.5) + math.rad(walkAnim*getMagnitudeXZ(torso.Velocity)*5/(1+sneaking)))), 0, idleAnimRotZ/20), 0.025+(math.min(1, getMagnitudeXZ(torso.Velocity))/12)*2)
  1738.  
  1739. if Mouse.Target and getDistance(head.CFrame.p, Mouse.Hit.p) <= 10.4 then
  1740. if Mouse.Target.Parent:FindFirstChild("Humanoid") == nil and Mouse.Target.Parent ~= camera then
  1741. selectBox.Adornee = Mouse.Target
  1742. else
  1743. selectBox.Adornee = nil
  1744. end
  1745. else
  1746. selectBox.Adornee = nil
  1747. end
  1748.  
  1749. --local neckYRot = math.rad(camPart.Orientation.Y - torso.Orientation.Y)
  1750.  
  1751. --neck.C1 = CFrame.new(0, 0.975, 0) * CFrame.fromEulerAnglesXYZ(math.rad(sneaking*45), neckYRot, 0)
  1752. --neck.C0 = CFrame.new(0, -0.65, 0) * CFrame.Angles(-math.rad(camPart.Orientation.X - torso.Orientation.X - (sneaking*45)), 0, 0)
  1753.  
  1754. --print(AngleDifference(camPart.Orientation, torso.Orientation).Y)
  1755.  
  1756. local BobbingY = walkAnim*2
  1757. if BobbingY >= 1 then BobbingY = -BobbingY + 0.5 end
  1758.  
  1759. cameraHandCFrame = cameraHandCFrame:lerp(CFrame.new(1.15*1.3 + (walkAnim/2 - (walkAnim/3)), -1.35*1.3 + camHandY + (-BobbingY/8), -0.45 + ((camera.FieldOfView/45)-1.6)*1.3) * CFrame.Angles(math.rad(punchRotXcam), math.rad(punchRotYcam), math.rad(punchRotZcam)) * CFrame.new(0, 0, -1.75) * CFrame.fromEulerAnglesXYZ(math.rad(85), math.rad(55), math.rad(22.5)), 0.25)
  1760.  
  1761. humOffset = humOffset:lerp(CFrame.new(walkAnim/4 - (walkAnim/8), BobbingY/13, 0), 0.25)
  1762. humanoid.CameraOffset = Vector3.new(humOffset.X, humOffset.Y, 0)
  1763.  
  1764. cameraHand.CFrame = camPart.CFrame * cameraHandCFrame
  1765.  
  1766. cameraHandItem.CFrame = cameraHand.CFrame * CFrame.new(0, -0.5, 0) * CFrame.Angles(math.rad(-210), math.rad(-40), math.rad(-100)) * CFrame.new(0, -0.35, 0)
  1767.  
  1768. if camCurrentZoom >= 1.5 then
  1769. cameraHand.Transparency = 1
  1770. for _,t in pairs(cameraHand:GetChildren()) do
  1771. if t.Transparency == 0 then
  1772. t.Transparency = 1
  1773. end
  1774. end
  1775. for _,t in pairs(cameraHandItem:GetChildren()) do
  1776. if t.Transparency == 0 then
  1777. t.Transparency = 1
  1778. end
  1779. end
  1780. else
  1781. changedPerspective = 0
  1782. cameraHand.Transparency = hasItemOnHand
  1783. for _,t in pairs(cameraHand:GetChildren()) do
  1784. if t.Transparency == 1 then
  1785. t.Transparency = hasItemOnHand
  1786. end
  1787. end
  1788. for _,t in pairs(cameraHandItem:GetChildren()) do
  1789. if t.Transparency == 1 then
  1790. t.Transparency = 0
  1791. end
  1792. end
  1793. end
  1794.  
  1795. if updateHand == true then
  1796. updateHand = false
  1797. updateItemOnHand()
  1798. end
  1799.  
  1800. if punching == 1 and punchEnded == 1 then
  1801. punching = 0
  1802. --print("steve uses punch!!")
  1803. local coPunchCam = coroutine.wrap(function()
  1804. local mult = 2
  1805. punchRotXcam = 40/2*mult
  1806. punchRotYcam = 25/2*mult
  1807. wait(0.075/2)
  1808. punchRotXcam = 50/2*mult
  1809. punchRotYcam = 25*mult
  1810. punchRotZcam = -10*mult
  1811. wait(0.075/2)
  1812. punchRotYcam = 50/1.5*mult
  1813. punchRotXcam = -10*mult
  1814. --wait(0.075/2)
  1815. --punchRotYcam = 50
  1816. --punchRotXcam = -10
  1817. wait(0.02)
  1818. punchRotXcam = -20*mult
  1819. wait(0.055)
  1820. punchRotXcam = 0
  1821. punchRotYcam = 0
  1822. punchRotZcam = 0
  1823. end)
  1824. local coPunch = coroutine.wrap(function()
  1825. punchEnded = 0
  1826. punchSpeed = 1
  1827. punchRotX = -60
  1828. punchRotY = -8
  1829. punchRotZ = -35
  1830.  
  1831. wait(0.075/1.3)
  1832. punchSpeed = 1
  1833. punchRotX = -75
  1834. punchRotY = 8
  1835. punchRotZ = 40
  1836. wait(0.075/1.3)
  1837. punchSpeed = 1
  1838. punchRotX = -20
  1839. punchRotZ = 40
  1840. wait(0.075/1.3)
  1841. punchSpeed = 3.5
  1842. punchRotX = 0
  1843. punchRotY = 0
  1844. punchRotZ = 0
  1845.  
  1846. punchRotXcam = 0
  1847. punchRotYcam = 0
  1848. punchRotZcam = 0
  1849.  
  1850. punchEnded = 1
  1851. wait(0.06/1.3)
  1852. punchSpeed = 0
  1853. end)
  1854. coPunch()
  1855. coPunchCam()
  1856. end
  1857. if ticks > 20 then
  1858. ticks = 0
  1859. if times == 0 then
  1860. times = times + 1
  1861. idleAnimRotX = -1
  1862. idleAnimRotZ = 0
  1863. elseif times == 1 then
  1864. times = times + 1
  1865. idleAnimRotX = -0.75
  1866. idleAnimRotZ = -0.75
  1867. elseif times == 2 then
  1868. times = times + 1
  1869. idleAnimRotX = 0
  1870. idleAnimRotZ = -1
  1871. elseif times == 3 then
  1872. times = times + 1
  1873. idleAnimRotX = 0.75
  1874. idleAnimRotZ = -0.75
  1875. --idleAnimRotX = 0.75
  1876. --idleAnimRotZ = -0
  1877. elseif times == 4 then
  1878. times = times + 1
  1879. idleAnimRotX = 1
  1880. idleAnimRotZ = 0
  1881. --idleAnimRotX = 1
  1882. --idleAnimRotZ = 0
  1883. elseif times == 5 then
  1884. times = times + 1
  1885. idleAnimRotX = 0.75
  1886. idleAnimRotZ = 0.75
  1887. elseif times == 6 then
  1888. times = times + 1
  1889. idleAnimRotX = 0
  1890. idleAnimRotZ = 1
  1891. elseif times == 7 then
  1892. times = 0
  1893. idleAnimRotX = -0.75
  1894. idleAnimRotZ = 0.75
  1895. end
  1896. end
  1897.  
  1898. if hi == 1 then hi = 0 end
  1899.  
  1900. local rotX = math.deg(math.atan2(humanoid.MoveDirection.Z, humanoid.MoveDirection.X)) + 90
  1901. if humanoid.MoveDirection ~= Vector3.new(0, 0, 0) then
  1902. --print(rotX)
  1903. bodyRot = bodyRot:lerp(CFrame.Angles(0, -math.rad(rotX), 0), 0.125)
  1904. humRootPart.CFrame = CFrame.new(humRootPart.CFrame.p.X, humRootPart.CFrame.p.Y, humRootPart.CFrame.p.Z) * bodyRot
  1905. end
  1906. local neckYRot = math.rad(camPart.Orientation.Y - torso.Orientation.Y)
  1907. neck.C1 = CFrame.new(0, 0.975, 0) * CFrame.fromEulerAnglesXYZ(math.rad(sneaking*45), neckYRot, 0)
  1908. neck.C0 = CFrame.new(0, -0.65, 0) * CFrame.Angles(-math.rad(camPart.Orientation.X - torso.Orientation.X - (sneaking*45)), 0, 0)
  1909.  
  1910. local oldTorsoOrientation = torso.Orientation
  1911. if AngleDifference(camPart.Orientation, torso.Orientation).Y > 45 then
  1912. humRootPart.CFrame = CFrame.new(humRootPart.CFrame.p.X, humRootPart.CFrame.p.Y, humRootPart.CFrame.p.Z) * CFrame.Angles(0, math.rad(head.Orientation.Y + 45), 0)
  1913. bodyRot = CFrame.Angles(0, math.rad(head.Orientation.Y + 45), 0)
  1914. --print("-45")
  1915. elseif AngleDifference(camPart.Orientation, torso.Orientation).Y < -45 then
  1916. humRootPart.CFrame = CFrame.new(humRootPart.CFrame.p.X, humRootPart.CFrame.p.Y, humRootPart.CFrame.p.Z) * CFrame.Angles(0, math.rad(head.Orientation.Y - 45), 0)
  1917. bodyRot = CFrame.Angles(0, math.rad(head.Orientation.Y - 45), 0)
  1918. --print("45")
  1919. end
  1920.  
  1921. neck.C1 = neck.C1 * CFrame.fromEulerAnglesXYZ(0, -math.rad(AngleDifference(oldTorsoOrientation, torso.Orientation).Y), 0)
  1922. ticks = ticks + 1
  1923. end
  1924. end
  1925. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement