Advertisement
Guest User

Steve script

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