Advertisement
Guest User

converted steve minecraft script

a guest
Jun 25th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 99.33 KB | None | 0 0
  1. -- NOTE (READ!!): This script doesn't work on voidacity's script builder
  2. -- since it crashes your game, but it's usable on other
  3. -- script builders like fancy dev's or nexure's.
  4. -- (it just doesn't work on voidacity only)
  5.  
  6. --[[
  7. -- converted
  8. print("converted by jj")
  9.  
  10.  
  11. ▓▒▒▓▓ ░▓▒▒██▒▒▓█▒▒▓▓ █▒▒▓█▒▒▒▒▒▒▒█▓▒▒▒▒▒▒▒█▒▓▒▒▒▒▒▓█▒▒▒▒▒▒▒█▓▒▒▒▓▒▒▓█▒▒▒▒▒▓▒▓░
  12. ▓ ░█▒ ▓░ ▓▓ ░█ ░█░▒ ▒▒ █░ █ ░ ▒▓ ▓▒ █ ░░
  13. ░░ ░ ▒██░░░ █░ ▓▓ ░░█░ ▓▒ ▒█████░ ▓█████░░ ▓▓ ░█ ▒█░█▓ ▒▓ ░███████▓ ██░
  14. ▓ ▓█▓ ▒▒█ █▒ ░█ ▓▒ ▒█████░ ▓█████░░ ▓▓ ░█ ▒█▓░ ░▓ ▓███████ █▓
  15. ▓ ░░ ▒█ █▒ ░ █░ ░░░░█░ ▓█████░ ▒██░ ▒██▒ ░█ ░ ░███ ▒░
  16. ▒░ ░░ ▓▓ █░ ▓▒ █░ ░░ ░█░ ▓█████░ █░ ░░ ░ █░ ░ ███░ ░▒
  17. ▒░ ▓▓ ▒▓ █░ ▒█ █▒ ░ █ ▓█████░ ▓ █░ ▒▓ █▒ ░ █▒ ▒█▓█████▓ ░▒
  18. ▒░▒░█▒▒█▓ █░ ▓█ ██░ ░ █░ ▓█████░ ▓█████░ ▒█ ░ █▒ ▒█ ░ █▒ ░███▓███▓░ ▒
  19. ░▒░ ▒█▓ ▒▒ ▒█░ ▓▓ ░██ ░▓ ▒ ░ █░ █░ ▒█ ▓▒ ░█ ▒▓ ███ ▓███░ ▒░
  20. ▒░ ░▓██▒░░ ▓▓ █▒ ▒██ ▓▓ ░ ░ ░█░ ░ █░ ▒█ ▓▓ █░ ▒█ █▓░ ░███▒ ░▒
  21. ▒▒ ▒███░▒ ░█ █▓ ░██░ ▒█ ░ █░ ░ █░ ▒█ █▒ ░█ ▓▓ ░█ ░██▓▒ ▓░
  22. ▒▒ ▒██▓▓▒ ▒▓ █░ ▓█▓ █░ ▒█░ █░ ▓▓ ░█░ ▓▒ ░█▒ ▓ ▓█▒░ ▒▒
  23. ▒▒░ █▓ ▓▒░▒█▒░░▓█░░▒█▒▒░░▓▓░▒▒▒░░▒█▒░░░░░░░█▒░▒█▓░░▓█▒░▒█░░░█▓░░▓▒ ▓█░░▒▒
  24. ░▒▒▒░ ▒░░▒▒░░░░░░░░ ▒░░░▒▒▒▒▒▒▒▒░░░░░░░░░░░░░▒▒▒▒▒▒▒▒▒▒░▒▒▒░░░░ ░░░▒░
  25. ASCII Art Generators are cool :)
  26.  
  27.  
  28.  
  29. ]]
  30.  
  31. -- Scroll down for changelog...
  32.  
  33. -- ORIGINAL CREATOR: Depr1
  34.  
  35. -- If this script isn't on pastebin or the user who uploaded this isn't called "Delros12"
  36. -- (and yes my pastebin account is Delros12) or the link is not https://pastebin.com/2NNDTLjL
  37. -- then this is not the original link of this script.
  38.  
  39. -- The original link of the script gets edited constantly for updates, if you use the original
  40. -- link you will be able to enjoy the most recent updates of this script without changing to
  41. -- another link which contains updated script.
  42.  
  43. -- Controls: Q to sneak, use the keypad numbers 1-9 to change blocks,
  44. -- choose a empty slot if you want to remove a block, E to open creative
  45. -- inventory, right-click to destroy a block in your toolbar in creative
  46. -- inventory, R to make camera face your character's front or back.
  47.  
  48. -- You will become steve when you use this script, if you die after
  49. -- using this script, keep trying to use it or wait 60 seconds
  50. -- (it doesn't work at first but eventually it will)
  51.  
  52. -- Enjoy! :)
  53.  
  54. local updateHand = false
  55. local Changelog = [[
  56.  
  57. Redstone coming soon. (not... sorry)
  58. Note (Read!): It will be a very long while till this script gets
  59. updated again, i stopped updating this since im focusing more on other things
  60. like C++ programming and game development, i'm not really that active much
  61. in roblox (and if im off im probably programming), so yeah, maybe in a
  62. million years i'll come back to update the script again (:P).
  63. 09/03/2018:
  64. + Added the heart bar.
  65. + Added death animation.
  66. * Your camera now shakes like in minecraft when hurt.
  67. * Toolbar Selection GUI now is accurate.
  68.  
  69. 02/03/2018:
  70. * Fixed a bug with the textures.
  71.  
  72. 01/03/2018:
  73. + Added a global grid.
  74. + Added something that i'm not sure how to describe.
  75. * Punching Animation in first person is now more accurate.
  76.  
  77. 17/02/2018:
  78. + You can't break your neck anymore (360 head you know)
  79. + Added this changelog
  80. - Removed the name tag, since it causes it to get banned on
  81. some servers for some reason (really voidacity?).
  82. * Walking animation is now more accurate
  83.  
  84. Note: It's been a while since i don't update the script, but i'll
  85. get back to updating it.
  86.  
  87. 05/02/2018:
  88. + Added gravity to sand and gravel (WARNING: Can be laggy!)
  89.  
  90. 04/02/2018:
  91. + Added creative inventory
  92. + Added 31 blocks (that's a lot, but not near minecraft's level)
  93. + Added sprinting (i'll add footsteps and particles later)
  94. - Removed Herobrine
  95. * Fixed a bug where the hand dissapears if u look down while sneaking
  96. * Fixed? (not sure) a bug where if u ran the script you would die
  97.  
  98. 01/02/2018:
  99. + Added the hand that appears on minecraft when ur first person
  100. + Added a walking animation to the hand
  101. + Punching animation added to the hand
  102. + Camera bobbing
  103. + Sneaking now lowers your camera just like in minecraft
  104. + Blocks now have sounds (i chose the ones that are the closest to minecraft sounds)
  105. + When a block is broken, particles will fall from it
  106. ]]
  107.  
  108. workspace:WaitForChild("Camera"):ClearAllChildren()
  109. local RS = game:GetService("RunService").RenderStepped
  110. local targetName = owner
  111. local player = game.Players:FindFirstChild(targetName)
  112.  
  113. local creativeInventory = {
  114. {
  115. name = "Dirt",
  116. size = Vector3.new(2.6, 2.6, 2.6),
  117. transparency = 0;
  118. frontTex = "rbxassetid://152569532",
  119. backTex = "rbxassetid://152569532",
  120. topTex = "rbxassetid://152569532",
  121. bottomTex = "rbxassetid://152569532",
  122. leftTex = "rbxassetid://152569532",
  123. rightTex = "rbxassetid://152569532",
  124. displayTex = "",
  125. sound = "rbxassetid://1102186681",
  126. soundVol = 1.25,
  127. hasGravity = false,
  128. objectType = "Block"
  129. },
  130. {
  131. name = "Grass",
  132. size = Vector3.new(2.6, 2.6, 2.6),
  133. transparency = 0;
  134. frontTex = "rbxassetid://96430337",
  135. backTex = "rbxassetid://96430337",
  136. topTex = "rbxassetid://96430265",
  137. bottomTex = "rbxassetid://179655033",
  138. leftTex = "rbxassetid://96430337",
  139. rightTex = "rbxassetid://96430337",
  140. displayTex = "",
  141. sound = "rbxassetid://1102186681",
  142. soundVol = 1.25,
  143. hasGravity = false,
  144. objectType = "Block"
  145. },
  146. {
  147. name = "Sand",
  148. size = Vector3.new(2.6, 2.6, 2.6),
  149. transparency = 0;
  150. frontTex = "rbxassetid://347007448",
  151. backTex = "rbxassetid://347007448",
  152. topTex = "rbxassetid://347007448",
  153. bottomTex = "rbxassetid://347007448",
  154. leftTex = "rbxassetid://347007448",
  155. rightTex = "rbxassetid://347007448",
  156. displayTex = "",
  157. sound = "rbxassetid://1102186681",
  158. soundVol = 1.25,
  159. hasGravity = true,
  160. objectType = "Block"
  161. },
  162. {
  163. name = "Gravel",
  164. size = Vector3.new(2.6, 2.6, 2.6),
  165. transparency = 0;
  166. frontTex = "rbxassetid://151701568",
  167. backTex = "rbxassetid://151701568",
  168. topTex = "rbxassetid://151701568",
  169. bottomTex = "rbxassetid://151701568",
  170. leftTex = "rbxassetid://151701568",
  171. rightTex = "rbxassetid://151701568",
  172. displayTex = "",
  173. sound = "rbxassetid://1102186681",
  174. soundVol = 1.25,
  175. hasGravity = true,
  176. objectType = "Block"
  177. },
  178. {
  179. name = "Stone",
  180. size = Vector3.new(2.6, 2.6, 2.6),
  181. transparency = 0;
  182. frontTex = "rbxassetid://75880927",
  183. backTex = "rbxassetid://75880927",
  184. topTex = "rbxassetid://75880927",
  185. bottomTex = "rbxassetid://75880927",
  186. leftTex = "rbxassetid://75880927",
  187. rightTex = "rbxassetid://75880927",
  188. displayTex = "",
  189. sound = "rbxassetid://1016978163",
  190. soundVol = 2,
  191. hasGravity = false,
  192. objectType = "Block"
  193. },
  194. {
  195. name = "Diamond Ore",
  196. size = Vector3.new(2.6, 2.6, 2.6),
  197. transparency = 0;
  198. frontTex = "rbxassetid://57928490",
  199. backTex = "rbxassetid://57928490",
  200. topTex = "rbxassetid://57928490",
  201. bottomTex = "rbxassetid://57928490",
  202. leftTex = "rbxassetid://57928490",
  203. rightTex = "rbxassetid://57928490",
  204. displayTex = "",
  205. sound = "rbxassetid://1016978163",
  206. soundVol = 2,
  207. hasGravity = false,
  208. objectType = "Block"
  209. },
  210. {
  211. name = "Diamond Block",
  212. size = Vector3.new(2.6, 2.6, 2.6),
  213. transparency = 0;
  214. frontTex = "rbxassetid://56749955",
  215. backTex = "rbxassetid://56749955",
  216. topTex = "rbxassetid://56749955",
  217. bottomTex = "rbxassetid://56749955",
  218. leftTex = "rbxassetid://56749955",
  219. rightTex = "rbxassetid://56749955",
  220. displayTex = "",
  221. sound = "rbxassetid://1016978163",
  222. soundVol = 2,
  223. hasGravity = false,
  224. objectType = "Block"
  225. },
  226. {
  227. name = "Emerald Block",
  228. size = Vector3.new(2.6, 2.6, 2.6),
  229. transparency = 0;
  230. frontTex = "rbxassetid://152410853",
  231. backTex = "rbxassetid://152410853",
  232. topTex = "rbxassetid://152410853",
  233. bottomTex = "rbxassetid://152410853",
  234. leftTex = "rbxassetid://152410853",
  235. rightTex = "rbxassetid://152410853",
  236. displayTex = "",
  237. sound = "rbxassetid://1016978163",
  238. soundVol = 2,
  239. hasGravity = false,
  240. objectType = "Block"
  241. },
  242. {
  243. name = "Emerald Ore",
  244. size = Vector3.new(2.6, 2.6, 2.6),
  245. transparency = 0;
  246. frontTex = "rbxassetid://152410868",
  247. backTex = "rbxassetid://152410868",
  248. topTex = "rbxassetid://152410868",
  249. bottomTex = "rbxassetid://152410868",
  250. leftTex = "rbxassetid://152410868",
  251. rightTex = "rbxassetid://152410868",
  252. displayTex = "",
  253. sound = "rbxassetid://1016978163",
  254. soundVol = 2,
  255. hasGravity = false,
  256. objectType = "Block"
  257. },
  258. {
  259. name = "Obsidian",
  260. size = Vector3.new(2.6, 2.6, 2.6),
  261. transparency = 0;
  262. frontTex = "rbxassetid://112560322",
  263. backTex = "rbxassetid://112560322",
  264. topTex = "rbxassetid://112560322",
  265. bottomTex = "rbxassetid://112560322",
  266. leftTex = "rbxassetid://112560322",
  267. rightTex = "rbxassetid://112560322",
  268. displayTex = "",
  269. sound = "rbxassetid://1016978163",
  270. soundVol = 2,
  271. hasGravity = false,
  272. objectType = "Block"
  273. },
  274. {
  275. name = "Gold Block",
  276. size = Vector3.new(2.6, 2.6, 2.6),
  277. transparency = 0;
  278. frontTex = "rbxassetid://152572128",
  279. backTex = "rbxassetid://152572128",
  280. topTex = "rbxassetid://152572128",
  281. bottomTex = "rbxassetid://152572128",
  282. leftTex = "rbxassetid://152572128",
  283. rightTex = "rbxassetid://152572128",
  284. displayTex = "",
  285. sound = "rbxassetid://1016978163",
  286. soundVol = 2,
  287. hasGravity = false,
  288. objectType = "Block"
  289. },
  290. {
  291. name = "Gold Ore",
  292. size = Vector3.new(2.6, 2.6, 2.6),
  293. transparency = 0;
  294. frontTex = "rbxassetid://152572121",
  295. backTex = "rbxassetid://152572121",
  296. topTex = "rbxassetid://152572121",
  297. bottomTex = "rbxassetid://152572121",
  298. leftTex = "rbxassetid://152572121",
  299. rightTex = "rbxassetid://152572121",
  300. displayTex = "",
  301. sound = "rbxassetid://1016978163",
  302. soundVol = 2,
  303. hasGravity = false,
  304. objectType = "Block"
  305. },
  306. {
  307. name = "Iron Block",
  308. size = Vector3.new(2.6, 2.6, 2.6),
  309. transparency = 0;
  310. frontTex = "rbxassetid://152572134",
  311. backTex = "rbxassetid://152572134",
  312. topTex = "rbxassetid://152572134",
  313. bottomTex = "rbxassetid://152572134",
  314. leftTex = "rbxassetid://152572134",
  315. rightTex = "rbxassetid://152572134",
  316. displayTex = "",
  317. sound = "rbxassetid://1016978163",
  318. soundVol = 2,
  319. hasGravity = false,
  320. objectType = "Block"
  321. },
  322. {
  323. name = "Iron Ore",
  324. size = Vector3.new(2.6, 2.6, 2.6),
  325. transparency = 0;
  326. frontTex = "rbxassetid://132879562",
  327. backTex = "rbxassetid://132879562",
  328. topTex = "rbxassetid://132879562",
  329. bottomTex = "rbxassetid://132879562",
  330. leftTex = "rbxassetid://132879562",
  331. rightTex = "rbxassetid://132879562",
  332. displayTex = "",
  333. sound = "rbxassetid://1016978163",
  334. soundVol = 2,
  335. hasGravity = false,
  336. objectType = "Block"
  337. },
  338. {
  339. name = "Redstone Block",
  340. size = Vector3.new(2.6, 2.6, 2.6),
  341. transparency = 0;
  342. frontTex = "rbxassetid://136260219",
  343. backTex = "rbxassetid://136260219",
  344. topTex = "rbxassetid://136260219",
  345. bottomTex = "rbxassetid://136260219",
  346. leftTex = "rbxassetid://136260219",
  347. rightTex = "rbxassetid://136260219",
  348. sound = "rbxassetid://1016978163",
  349. soundVol = 2,
  350. hasGravity = false,
  351. objectType = "Block"
  352. },
  353. {
  354. name = "Redstone Ore",
  355. size = Vector3.new(2.6, 2.6, 2.6),
  356. transparency = 0;
  357. frontTex = "rbxassetid://152572209",
  358. backTex = "rbxassetid://152572209",
  359. topTex = "rbxassetid://152572209",
  360. bottomTex = "rbxassetid://152572209",
  361. leftTex = "rbxassetid://152572209",
  362. rightTex = "rbxassetid://152572209",
  363. displayTex = "",
  364. sound = "rbxassetid://1016978163",
  365. soundVol = 2,
  366. hasGravity = false,
  367. objectType = "Block"
  368. },
  369. {
  370. name = "Coal Block",
  371. size = Vector3.new(2.6, 2.6, 2.6),
  372. transparency = 0;
  373. frontTex = "rbxassetid://152527418",
  374. backTex = "rbxassetid://152527418",
  375. topTex = "rbxassetid://152527418",
  376. bottomTex = "rbxassetid://152527418",
  377. leftTex = "rbxassetid://152527418",
  378. rightTex = "rbxassetid://152527418",
  379. displayTex = "",
  380. sound = "rbxassetid://1016978163",
  381. soundVol = 2,
  382. hasGravity = false,
  383. objectType = "Block"
  384. },
  385. {
  386. name = "Coal Ore",
  387. size = Vector3.new(2.6, 2.6, 2.6),
  388. transparency = 0;
  389. frontTex = "rbxassetid://152572101",
  390. backTex = "rbxassetid://152572101",
  391. topTex = "rbxassetid://152572101",
  392. bottomTex = "rbxassetid://152572101",
  393. leftTex = "rbxassetid://152572101",
  394. rightTex = "rbxassetid://152572101",
  395. displayTex = "",
  396. sound = "rbxassetid://1016978163",
  397. soundVol = 2,
  398. hasGravity = false,
  399. objectType = "Block"
  400. },
  401. {
  402. name = "Bedrock",
  403. size = Vector3.new(2.6, 2.6, 2.6),
  404. transparency = 0;
  405. frontTex = "rbxassetid://75881126",
  406. backTex = "rbxassetid://75881126",
  407. topTex = "rbxassetid://75881126",
  408. bottomTex = "rbxassetid://75881126",
  409. leftTex = "rbxassetid://75881126",
  410. rightTex = "rbxassetid://75881126",
  411. displayTex = "",
  412. sound = "rbxassetid://1016978163",
  413. soundVol = 2,
  414. hasGravity = false,
  415. objectType = "Block"
  416. },
  417. {
  418. name = "Cobblestone",
  419. size = Vector3.new(2.6, 2.6, 2.6),
  420. transparency = 0;
  421. frontTex = "rbxassetid://152572105",
  422. backTex = "rbxassetid://152572105",
  423. topTex = "rbxassetid://152572105",
  424. bottomTex = "rbxassetid://152572105",
  425. leftTex = "rbxassetid://152572105",
  426. rightTex = "rbxassetid://152572105",
  427. displayTex = "",
  428. sound = "rbxassetid://1016978163",
  429. soundVol = 2,
  430. hasGravity = false,
  431. objectType = "Block"
  432. },
  433. {
  434. name = "Mossy Stone Brick",
  435. size = Vector3.new(2.6, 2.6, 2.6),
  436. transparency = 0;
  437. frontTex = "rbxassetid://61826751",
  438. backTex = "rbxassetid://61826751",
  439. topTex = "rbxassetid://61826751",
  440. bottomTex = "rbxassetid://61826751",
  441. leftTex = "rbxassetid://61826751",
  442. rightTex = "rbxassetid://61826751",
  443. displayTex = "",
  444. sound = "rbxassetid://1016978163",
  445. soundVol = 2,
  446. hasGravity = false,
  447. objectType = "Block"
  448. },
  449. {
  450. name = "Cracked Stone Brick",
  451. size = Vector3.new(2.6, 2.6, 2.6),
  452. transparency = 0;
  453. frontTex = "rbxassetid://151802087",
  454. backTex = "rbxassetid://151802087",
  455. topTex = "rbxassetid://151802087",
  456. bottomTex = "rbxassetid://151802087",
  457. leftTex = "rbxassetid://151802087",
  458. rightTex = "rbxassetid://151802087",
  459. displayTex = "",
  460. sound = "rbxassetid://1016978163",
  461. soundVol = 2,
  462. hasGravity = false,
  463. objectType = "Block"
  464. },
  465. {
  466. name = "Chiseled Stone Brick",
  467. size = Vector3.new(2.6, 2.6, 2.6),
  468. transparency = 0;
  469. frontTex = "rbxassetid://151802074",
  470. backTex = "rbxassetid://151802074",
  471. topTex = "rbxassetid://151802074",
  472. bottomTex = "rbxassetid://151802074",
  473. leftTex = "rbxassetid://151802074",
  474. rightTex = "rbxassetid://151802074",
  475. displayTex = "",
  476. sound = "rbxassetid://1016978163",
  477. soundVol = 2,
  478. hasGravity = false,
  479. objectType = "Block"
  480. },
  481. {
  482. name = "Stone Brick",
  483. size = Vector3.new(2.6, 2.6, 2.6),
  484. transparency = 0;
  485. frontTex = "rbxassetid://61826773",
  486. backTex = "rbxassetid://61826773",
  487. topTex = "rbxassetid://61826773",
  488. bottomTex = "rbxassetid://61826773",
  489. leftTex = "rbxassetid://61826773",
  490. rightTex = "rbxassetid://61826773",
  491. displayTex = "",
  492. sound = "rbxassetid://1016978163",
  493. soundVol = 2,
  494. hasGravity = false,
  495. objectType = "Block"
  496. },
  497. {
  498. name = "Nether Brick",
  499. size = Vector3.new(2.6, 2.6, 2.6),
  500. transparency = 0;
  501. frontTex = "rbxassetid://151802104",
  502. backTex = "rbxassetid://151802104",
  503. topTex = "rbxassetid://151802104",
  504. bottomTex = "rbxassetid://151802104",
  505. leftTex = "rbxassetid://151802104",
  506. rightTex = "rbxassetid://151802104",
  507. displayTex = "",
  508. sound = "rbxassetid://1016978163",
  509. soundVol = 2,
  510. hasGravity = false,
  511. objectType = "Block"
  512. },
  513. {
  514. name = "Granite",
  515. size = Vector3.new(2.6, 2.6, 2.6),
  516. transparency = 0;
  517. frontTex = "rbxassetid://151776467",
  518. backTex = "rbxassetid://151776467",
  519. topTex = "rbxassetid://151776467",
  520. bottomTex = "rbxassetid://151776467",
  521. leftTex = "rbxassetid://151776467",
  522. rightTex = "rbxassetid://151776467",
  523. displayTex = "",
  524. sound = "rbxassetid://1016978163",
  525. soundVol = 2,
  526. hasGravity = false,
  527. objectType = "Block"
  528. },
  529. {
  530. name = "Diorite",
  531. size = Vector3.new(2.6, 2.6, 2.6),
  532. transparency = 0;
  533. frontTex = "rbxassetid://151776452",
  534. backTex = "rbxassetid://151776452",
  535. topTex = "rbxassetid://151776452",
  536. bottomTex = "rbxassetid://151776452",
  537. leftTex = "rbxassetid://151776452",
  538. rightTex = "rbxassetid://151776452",
  539. sound = "rbxassetid://1016978163",
  540. soundVol = 2,
  541. hasGravity = false,
  542. objectType = "Block"
  543. },
  544. {
  545. name = "Andesite",
  546. size = Vector3.new(2.6, 2.6, 2.6),
  547. transparency = 0;
  548. frontTex = "rbxassetid://151776422",
  549. backTex = "rbxassetid://151776422",
  550. topTex = "rbxassetid://151776422",
  551. bottomTex = "rbxassetid://151776422",
  552. leftTex = "rbxassetid://151776422",
  553. rightTex = "rbxassetid://151776422",
  554. displayTex = "",
  555. sound = "rbxassetid://1016978163",
  556. soundVol = 2,
  557. hasGravity = false,
  558. objectType = "Block"
  559. },
  560. {
  561. name = "Polished Granite",
  562. size = Vector3.new(2.6, 2.6, 2.6),
  563. transparency = 0;
  564. frontTex = "rbxassetid://151776506",
  565. backTex = "rbxassetid://151776506",
  566. topTex = "rbxassetid://151776506",
  567. bottomTex = "rbxassetid://151776506",
  568. leftTex = "rbxassetid://151776506",
  569. rightTex = "rbxassetid://151776506",
  570. displayTex = "",
  571. sound = "rbxassetid://1016978163",
  572. soundVol = 2,
  573. hasGravity = false,
  574. objectType = "Block"
  575. },
  576. {
  577. name = "Polished Diorite",
  578. size = Vector3.new(2.6, 2.6, 2.6),
  579. transparency = 0;
  580. frontTex = "rbxassetid://151776533",
  581. backTex = "rbxassetid://151776533",
  582. topTex = "rbxassetid://151776533",
  583. bottomTex = "rbxassetid://151776533",
  584. leftTex = "rbxassetid://151776533",
  585. rightTex = "rbxassetid://151776533",
  586. displayTex = "",
  587. sound = "rbxassetid://1016978163",
  588. soundVol = 2,
  589. hasGravity = false,
  590. objectType = "Block"
  591. },
  592. {
  593. name = "Polished Andesite",
  594. size = Vector3.new(2.6, 2.6, 2.6),
  595. transparency = 0;
  596. frontTex = "rbxassetid://151776506",
  597. backTex = "rbxassetid://151776506",
  598. topTex = "rbxassetid://151776506",
  599. bottomTex = "rbxassetid://151776506",
  600. leftTex = "rbxassetid://151776506",
  601. rightTex = "rbxassetid://151776506",
  602. displayTex = "",
  603. sound = "rbxassetid://1016978163",
  604. soundVol = 2,
  605. hasGravity = false,
  606. objectType = "Block"
  607. },
  608. {
  609. name = "Brick Block",
  610. size = Vector3.new(2.6, 2.6, 2.6),
  611. transparency = 0;
  612. frontTex = "rbxassetid://59389191",
  613. backTex = "rbxassetid://59389191",
  614. topTex = "rbxassetid://59389191",
  615. bottomTex = "rbxassetid://59389191",
  616. leftTex = "rbxassetid://59389191",
  617. rightTex = "rbxassetid://59389191",
  618. displayTex = "",
  619. sound = "rbxassetid://1016978163",
  620. soundVol = 2,
  621. hasGravity = false,
  622. objectType = "Block"
  623. },
  624. {
  625. name = "Packed Ice",
  626. size = Vector3.new(2.6, 2.6, 2.6),
  627. transparency = 0;
  628. frontTex = "rbxassetid://152528023",
  629. backTex = "rbxassetid://152528023",
  630. topTex = "rbxassetid://152528023",
  631. bottomTex = "rbxassetid://152528023",
  632. leftTex = "rbxassetid://152528023",
  633. rightTex = "rbxassetid://152528023",
  634. displayTex = "",
  635. sound = "rbxassetid://1016978163",
  636. soundVol = 2,
  637. hasGravity = false,
  638. objectType = "Block"
  639. },
  640. {
  641. name = "Ice Block",
  642. size = Vector3.new(2.6, 2.6, 2.6),
  643. transparency = 1;
  644. frontTex = "rbxassetid://118555586",
  645. backTex = "rbxassetid://118555586",
  646. topTex = "rbxassetid://118555586",
  647. bottomTex = "rbxassetid://118555586",
  648. leftTex = "rbxassetid://118555586",
  649. rightTex = "rbxassetid://118555586",
  650. displayTex = "",
  651. sound = "rbxassetid://1016978163",
  652. soundVol = 2,
  653. hasGravity = false,
  654. objectType = "Block"
  655. },
  656. {
  657. name = "Netherrack",
  658. size = Vector3.new(2.6, 2.6, 2.6),
  659. transparency = 0;
  660. frontTex = "rbxassetid://151802119",
  661. backTex = "rbxassetid://151802119",
  662. topTex = "rbxassetid://151802119",
  663. bottomTex = "rbxassetid://151802119",
  664. leftTex = "rbxassetid://151802119",
  665. rightTex = "rbxassetid://151802119",
  666. displayTex = "",
  667. sound = "rbxassetid://1016978163",
  668. soundVol = 2,
  669. hasGravity = false,
  670. objectType = "Block"
  671. },
  672. {
  673. name = "End Stone",
  674. size = Vector3.new(2.6, 2.6, 2.6),
  675. transparency = 0;
  676. frontTex = "rbxassetid://151802091",
  677. backTex = "rbxassetid://151802091",
  678. topTex = "rbxassetid://151802091",
  679. bottomTex = "rbxassetid://151802091",
  680. leftTex = "rbxassetid://151802091",
  681. rightTex = "rbxassetid://151802091",
  682. displayTex = "",
  683. sound = "rbxassetid://1016978163",
  684. soundVol = 2,
  685. hasGravity = false,
  686. objectType = "Block"
  687. },
  688. {
  689. name = "Glass Block",
  690. size = Vector3.new(2.6, 2.6, 2.6),
  691. transparency = 1;
  692. frontTex = "rbxassetid://152239003",
  693. backTex = "rbxassetid://152239003",
  694. topTex = "rbxassetid://152239003",
  695. bottomTex = "rbxassetid://152239003",
  696. leftTex = "rbxassetid://152239003",
  697. rightTex = "rbxassetid://152239003",
  698. displayTex = "",
  699. sound = "rbxassetid://1016978163",
  700. soundVol = 2,
  701. hasGravity = false,
  702. objectType = "Block"
  703. },
  704. {
  705. name = "Glowstone",
  706. size = Vector3.new(2.6, 2.6, 2.6),
  707. transparency = 0;
  708. frontTex = "rbxassetid://54790811",
  709. backTex = "rbxassetid://54790811",
  710. topTex = "rbxassetid://54790811",
  711. bottomTex = "rbxassetid://54790811",
  712. leftTex = "rbxassetid://54790811",
  713. rightTex = "rbxassetid://54790811",
  714. displayTex = "",
  715. sound = "rbxassetid://1016978163",
  716. soundVol = 2,
  717. hasGravity = false,
  718. objectType = "Block"
  719. },
  720. {
  721. name = "Bookshelf",
  722. size = Vector3.new(2.6, 2.6, 2.6),
  723. transparency = 0;
  724. frontTex = "rbxassetid://118554092",
  725. backTex = "rbxassetid://118554092",
  726. topTex = "rbxassetid://346201871",
  727. bottomTex = "rbxassetid://346201871",
  728. leftTex = "rbxassetid://118554092",
  729. rightTex = "rbxassetid://118554092",
  730. displayTex = "",
  731. sound = "rbxassetid://507863457",
  732. soundVol = 2,
  733. hasGravity = false,
  734. objectType = "Block"
  735. },
  736. {
  737. name = "Oak Wood Planks",
  738. size = Vector3.new(2.6, 2.6, 2.6),
  739. transparency = 0;
  740. frontTex = "rbxassetid://346201871",
  741. backTex = "rbxassetid://346201871",
  742. topTex = "rbxassetid://346201871",
  743. bottomTex = "rbxassetid://346201871",
  744. leftTex = "rbxassetid://346201871",
  745. rightTex = "rbxassetid://346201871",
  746. displayTex = "",
  747. sound = "rbxassetid://507863457",
  748. soundVol = 2,
  749. hasGravity = false,
  750. objectType = "Block"
  751. },
  752. {
  753. name = "Oak Log",
  754. size = Vector3.new(2.6, 2.6, 2.6),
  755. transparency = 0;
  756. frontTex = "rbxassetid://71445924",
  757. backTex = "rbxassetid://71445924",
  758. topTex = "rbxassetid://152538557",
  759. bottomTex = "rbxassetid://152538557",
  760. leftTex = "rbxassetid://71445924",
  761. rightTex = "rbxassetid://71445924",
  762. displayTex = "",
  763. sound = "rbxassetid://507863457",
  764. soundVol = 2,
  765. hasGravity = false,
  766. objectType = "Block"
  767. },
  768. {
  769. name = "Oak Leaves",
  770. size = Vector3.new(2.6, 2.6, 2.6),
  771. transparency = 1;
  772. frontTex = "rbxassetid://151708391",
  773. backTex = "rbxassetid://151708391",
  774. topTex = "rbxassetid://151708391",
  775. bottomTex = "rbxassetid://151708391",
  776. leftTex = "rbxassetid://151708391",
  777. rightTex = "rbxassetid://151708391",
  778. displayTex = "",
  779. sound = "rbxassetid://507863457",
  780. -- couldn't find a leaves sound for this one, sorry lol
  781. soundVol = 2,
  782. hasGravity = false,
  783. objectType = "Block"
  784. }
  785. }
  786. local toolBar = {
  787. {
  788. name = "Dirt Block",
  789. size = Vector3.new(2.6, 2.6, 2.6),
  790. transparency = 0;
  791. frontTex = "rbxassetid://152569532",
  792. backTex = "rbxassetid://152569532",
  793. topTex = "rbxassetid://152569532",
  794. bottomTex = "rbxassetid://152569532",
  795. leftTex = "rbxassetid://152569532",
  796. rightTex = "rbxassetid://152569532",
  797. displayTex = "",
  798. sound = "rbxassetid://1102186681",
  799. soundVol = 1.25,
  800. hasGravity = false,
  801. objectType = "Block"
  802. },
  803. {
  804. name = "Grass Block",
  805. size = Vector3.new(2.6, 2.6, 2.6),
  806. transparency = 0;
  807. frontTex = "rbxassetid://96430337",
  808. backTex = "rbxassetid://96430337",
  809. topTex = "rbxassetid://96430265",
  810. bottomTex = "rbxassetid://179655033",
  811. leftTex = "rbxassetid://96430337",
  812. rightTex = "rbxassetid://96430337",
  813. displayTex = "",
  814. sound = "rbxassetid://1102186681",
  815. soundVol = 1.25,
  816. hasGravity = false,
  817. objectType = "Block"
  818. },
  819. {
  820. name = "Stone",
  821. size = Vector3.new(2.6, 2.6, 2.6),
  822. transparency = 0;
  823. frontTex = "rbxassetid://75880927",
  824. backTex = "rbxassetid://75880927",
  825. topTex = "rbxassetid://75880927",
  826. bottomTex = "rbxassetid://75880927",
  827. leftTex = "rbxassetid://75880927",
  828. rightTex = "rbxassetid://75880927",
  829. displayTex = "",
  830. sound = "rbxassetid://1016978163",
  831. soundVol = 2,
  832. hasGravity = false,
  833. objectType = "Block"
  834. },
  835. {
  836. name = "Diamond Ore",
  837. size = Vector3.new(2.6, 2.6, 2.6),
  838. transparency = 0;
  839. frontTex = "rbxassetid://57928490",
  840. backTex = "rbxassetid://57928490",
  841. topTex = "rbxassetid://57928490",
  842. bottomTex = "rbxassetid://57928490",
  843. leftTex = "rbxassetid://57928490",
  844. rightTex = "rbxassetid://57928490",
  845. displayTex = "",
  846. sound = "rbxassetid://1016978163",
  847. soundVol = 2,
  848. hasGravity = false,
  849. objectType = "Block"
  850. },
  851. {
  852. name = "Diamond Block",
  853. size = Vector3.new(2.6, 2.6, 2.6),
  854. transparency = 0;
  855. frontTex = "rbxassetid://56749955",
  856. backTex = "rbxassetid://56749955",
  857. topTex = "rbxassetid://56749955",
  858. bottomTex = "rbxassetid://56749955",
  859. leftTex = "rbxassetid://56749955",
  860. rightTex = "rbxassetid://56749955",
  861. displayTex = "",
  862. sound = "rbxassetid://1016978163",
  863. soundVol = 2,
  864. hasGravity = false,
  865. objectType = "Block"
  866. },
  867. {
  868. name = "Oak Wood Planks",
  869. size = Vector3.new(2.6, 2.6, 2.6),
  870. transparency = 0;
  871. frontTex = "rbxassetid://346201871",
  872. backTex = "rbxassetid://346201871",
  873. topTex = "rbxassetid://346201871",
  874. bottomTex = "rbxassetid://346201871",
  875. leftTex = "rbxassetid://346201871",
  876. rightTex = "rbxassetid://346201871",
  877. displayTex = "",
  878. sound = "rbxassetid://507863457",
  879. soundVol = 2,
  880. hasGravity = false,
  881. objectType = "Block"
  882. },
  883. {
  884. name = "Oak Log",
  885. size = Vector3.new(2.6, 2.6, 2.6),
  886. transparency = 0;
  887. frontTex = "rbxassetid://71445924",
  888. backTex = "rbxassetid://71445924",
  889. topTex = "rbxassetid://152538557",
  890. bottomTex = "rbxassetid://152538557",
  891. leftTex = "rbxassetid://71445924",
  892. rightTex = "rbxassetid://71445924",
  893. displayTex = "",
  894. sound = "rbxassetid://507863457",
  895. soundVol = 2,
  896. hasGravity = false,
  897. objectType = "Block"
  898. }
  899. --[[{
  900. name = "Redstone",
  901. size = Vector3.new(2.6, 0.05, 2.6),
  902. transparency = 1;
  903. frontTex = "rbxassetid://151911305",
  904. backTex = "",
  905. topTex = "rbxassetid://151911305",
  906. bottomTex = "",
  907. leftTex = "",
  908. rightTex = "",
  909. displayTex = "rbxassetid://64124418",
  910. sound = "rbxassetid://1016978163",
  911. soundVol = 2,
  912. hasGravity = false,
  913. objectType = "Redstone Dust"
  914. },]]
  915. }
  916. function putTexture(part, frontF, backF, topF, bottomF, leftF, rightF, className)
  917. local faces = {"Front", "Back", "Top", "Bottom", "Left", "Right"}
  918. for i,f in pairs(faces) do
  919. local decal = Instance.new(className, part)
  920. if i == 1 then decal.Texture = frontF decal.Name = f end
  921. if i == 2 then decal.Texture = backF or frontF decal.Name = f end
  922. if i == 3 then decal.Texture = topF or frontF decal.Name = f end
  923. if i == 4 then decal.Texture = bottomF or frontF decal.Name = f end
  924. if i == 5 then decal.Texture = leftF or frontF decal.Name = f end
  925. if i == 6 then decal.Texture = rightF or frontF decal.Name = f end
  926. decal.Face = f
  927. end
  928. return part
  929. end
  930. function makeSquare(position, size, color, transparency, parent, zindex)
  931. local label = Instance.new("TextLabel", parent)
  932. label.Text = ""
  933. label.BorderSizePixel = 0
  934. label.BackgroundTransparency = transparency
  935. label.Position = position
  936. label.Size = size
  937. label.BackgroundColor3 = color
  938. if zindex == nil then label.ZIndex = 1 else label.ZIndex = zindex end
  939. return label
  940. end
  941. function makeImage(position, size, image, parent, zindex)
  942. local imglabel = Instance.new("ImageLabel", parent)
  943. imglabel.BorderSizePixel = 0
  944. imglabel.BackgroundTransparency = 1
  945. imglabel.Position = position
  946. imglabel.Size = size
  947. imglabel.Image = image
  948. if zindex == nil then imglabel.ZIndex = 1 else imglabel.ZIndex = zindex end
  949. return imglabel
  950. end
  951. function putInventorySlot(position, image, parent, zindex)
  952. local button = Instance.new("TextButton", parent)
  953. button.Position = position
  954. button.Size = UDim2.new(0, 36, 0, 36)
  955. button.BackgroundColor3 = Color3.new(139/255, 139/255, 139/255)
  956. button.Text = ""
  957. button.BorderSizePixel = 0
  958. button.ZIndex = zindex
  959. local imageLabel = Instance.new("ImageLabel", button)
  960. imageLabel.BackgroundTransparency = 0.9
  961. imageLabel.Position = UDim2.new(0, 2, 0, 2)
  962. imageLabel.Size = UDim2.new(0, 32, 0, 32)
  963. imageLabel.Image = image
  964. imageLabel.BorderSizePixel = 0
  965. imageLabel.ZIndex = zindex
  966. makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 34, 0, 2),
  967. Color3.new(55/255, 55/255, 55/255), 0, button, zindex)
  968. makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 2, 0, 34),
  969. Color3.new(55/255, 55/255, 55/255), 0, button, zindex)
  970. makeSquare(UDim2.new(0, 34, 0, 2), UDim2.new(0, 2, 0, 34),
  971. Color3.new(255/255, 255/255, 255/255), 0, button, zindex)
  972. makeSquare(UDim2.new(0, 2, 0, 34), UDim2.new(0, 34, 0, 2),
  973. Color3.new(255/255, 255/255, 255/255), 0, button, zindex)
  974. return button
  975. end
  976.  
  977. function AngleDifference(Angle1, Angle2)
  978. local Difference = {X = 0, Y = 0, Z = 0}
  979. Difference.X = Angle2.X - Angle1.X
  980.  
  981. if (Difference.X > 180) then
  982. Difference.X = Difference.X - 360
  983. elseif (Difference.X < -180) then
  984. Difference.X = Difference.X + 360
  985. end
  986.  
  987. Difference.Y = Angle2.Y - Angle1.Y
  988.  
  989. if (Difference.Y > 180) then
  990. Difference.Y = Difference.Y - 360
  991. elseif (Difference.Y < -180) then
  992. Difference.Y = Difference.Y + 360
  993. end
  994.  
  995. Difference.Z = Angle2.Z - Angle1.Z
  996.  
  997. if (Difference.Z > 180) then
  998. Difference.Z = Difference.Z - 360
  999. elseif (Difference.Z < -180) then
  1000. Difference.Z = Difference.Z + 360
  1001. end
  1002.  
  1003. return Vector3.new(Difference.X, Difference.Y, Difference.Z)
  1004. end
  1005.  
  1006. local draggingBlock = nil
  1007. function makeInventory()
  1008. local playerGui = player:FindFirstChild("PlayerGui")
  1009. if playerGui then
  1010. local invGui = Instance.new("ScreenGui", playerGui)
  1011. local creativeInv = Instance.new("Frame", invGui)
  1012. creativeInv.BackgroundTransparency = 1
  1013. creativeInv.Position = UDim2.new(0.5, -170, 0.5, -202)
  1014.  
  1015. creativeInv.Visible = false
  1016.  
  1017. -- creative inventory GUI...
  1018.  
  1019. local blackOut = makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 1, 0),
  1020. Color3.new(0/255, 0/255, 0/255), 0.3, invGui, 1)
  1021. blackOut.Visible = false
  1022.  
  1023. creativeInv.Changed:connect(function()
  1024. blackOut.Visible = creativeInv.Visible
  1025. end)
  1026.  
  1027. local changeLog = Instance.new("TextLabel", invGui)
  1028. changeLog.Text = Changelog
  1029. changeLog.Font = "SourceSans"
  1030. changeLog.FontSize = Enum.FontSize.Size12
  1031. changeLog.Size = UDim2.new(0, changeLog.TextBounds.X, 0, changeLog.TextBounds.Y + 2)
  1032. changeLog.BackgroundColor3 = Color3.new(0, 0, 0)
  1033. changeLog.BorderSizePixel = 0
  1034. changeLog.BackgroundTransparency = 0.5
  1035. changeLog.Position = UDim2.new(0.5, -changeLog.Size.X.Offset/2, 0.5, -changeLog.Size.Y.Offset/2)
  1036. changeLog.TextColor3 = Color3.new(1, 1, 1)
  1037. changeLog.TextXAlignment = "Left"
  1038. changeLog.TextYAlignment = "Top"
  1039.  
  1040. local coolButton = Instance.new("TextButton", changeLog)
  1041. coolButton.Position = UDim2.new(1, -17, 0, 1)
  1042. coolButton.Size = UDim2.new(0, 16, 0, 12)
  1043. coolButton.Text = "X"
  1044. coolButton.Font = "SourceSans"
  1045. coolButton.FontSize = Enum.FontSize.Size12
  1046. coolButton.BorderSizePixel = 0
  1047. coolButton.BackgroundColor3 = Color3.new(1, 0, 0)
  1048. coolButton.BackgroundTransparency = 0.2
  1049. coolButton.TextColor3 = Color3.new(1, 1, 1)
  1050. coolButton.TextStrokeTransparency = 0.5
  1051. coolButton.ZIndex = 2
  1052.  
  1053. local line = makeSquare(UDim2.new(0, 0, 1, -14), UDim2.new(1, 0, 0, 14),
  1054. Color3.new(0, 0, 0), 0.75, changeLog, 2)
  1055.  
  1056. local line2 = makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 0, 14),
  1057. Color3.new(1, 1, 1), 0.9, changeLog, 1)
  1058.  
  1059. line2.Text = "Change Log"
  1060. line2.TextColor3 = Color3.new(1, 1, 1)
  1061. line2.TextStrokeTransparency = 0.75
  1062. line2.Font = "SourceSans"
  1063. line2.FontSize = Enum.FontSize.Size12
  1064.  
  1065. line.Text = "Made by Depr1"
  1066. line.TextColor3 = Color3.new(1, 0.65, 0)
  1067. line.TextStrokeTransparency = 0.5
  1068. line.Font = "SourceSans"
  1069. line.FontSize = Enum.FontSize.Size14
  1070. line.TextXAlignment = "Left"
  1071.  
  1072. coolButton.MouseButton1Click:connect(function()
  1073. changeLog.Visible = false
  1074. end)
  1075.  
  1076. makeSquare(UDim2.new(0, -2, 0, 2), UDim2.new(0, 340, 0, 404),
  1077. Color3.new(198/255, 198/255, 198/255), 0, creativeInv, 3)
  1078. makeSquare(UDim2.new(0, 338, 0, 0), UDim2.new(0, 6, 0, 406),
  1079. Color3.new(85/255, 85/255, 85/255), 0, creativeInv, 2)
  1080. makeSquare(UDim2.new(0, 0, 0, 404), UDim2.new(0, 342, 0, 4),
  1081. Color3.new(85/255, 85/255, 85/255), 0, creativeInv, 3)
  1082. makeSquare(UDim2.new(0, 2, 0, 0), UDim2.new(0, 338, 0, 402),
  1083. Color3.new(198/255, 198/255, 198/255), 0, creativeInv, 3)
  1084. makeSquare(UDim2.new(0, -4, 0, -2), UDim2.new(0, 4, 0, 406),
  1085. Color3.new(255/255, 255/255, 255/255), 0, creativeInv, 3)
  1086. makeSquare(UDim2.new(0, -2, 0, -4), UDim2.new(0, 342, 0, 6),
  1087. Color3.new(255/255, 255/255, 255/255), 0, creativeInv, 2)
  1088. makeSquare(UDim2.new(0, 340, 0, -2), UDim2.new(0, 2, 0, 2),
  1089. Color3.new(198/255, 198/255, 198/255), 0, creativeInv, 2)
  1090. makeSquare(UDim2.new(0, 340, 0, -4), UDim2.new(0, 2, 0, 4),
  1091. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  1092. makeSquare(UDim2.new(0, 342, 0, -2), UDim2.new(0, 2, 0, 2),
  1093. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  1094. makeSquare(UDim2.new(0, 344, 0, 0), UDim2.new(0, 2, 0, 406),
  1095. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  1096. makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 2, 0, 4),
  1097. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  1098. makeSquare(UDim2.new(0, -2, 0, -6), UDim2.new(0, 342, 0, 4),
  1099. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  1100. makeSquare(UDim2.new(0, 0, 0, 406), UDim2.new(0, 342, 0, 4),
  1101. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  1102. makeSquare(UDim2.new(0, 342, 0, 404), UDim2.new(0, 2, 0, 4),
  1103. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  1104. makeSquare(UDim2.new(0, -4, 0, 404), UDim2.new(0, 2, 0, 2),
  1105. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  1106. makeSquare(UDim2.new(0, -2, 0, 406), UDim2.new(0, 2, 0, 2),
  1107. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  1108. makeSquare(UDim2.new(0, -6, 0, -2), UDim2.new(0, 2, 0, 406),
  1109. Color3.new(0/255, 0/255, 0/255), 0, creativeInv, 1)
  1110. 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)
  1111. text.Text = "Creative Inventory"
  1112. text.Font = "SourceSansSemibold"
  1113. text.TextSize = 14
  1114. text.TextXAlignment = "Left"
  1115. --
  1116. local draggingBlockPicture = Instance.new("ImageLabel", invGui)
  1117. draggingBlockPicture.BackgroundTransparency = 1
  1118. draggingBlockPicture.Size = UDim2.new(0, 32, 0, 32)
  1119. draggingBlockPicture.ZIndex = 5
  1120. coroutine.resume(coroutine.create(function()
  1121. local invMouse = player:GetMouse()
  1122. --local RS = game:GetService("RunService").RenderStepped
  1123. invMouse.Button2Down:connect(function()
  1124. draggingBlock = nil
  1125. end)
  1126. while RS:wait() do
  1127. draggingBlockPicture.Position = UDim2.new(0, invMouse.X - 16, 0, invMouse.Y - 16)
  1128. if draggingBlock ~= nil then
  1129. draggingBlockPicture.Image = draggingBlock.frontTex
  1130. else
  1131. draggingBlockPicture.Image = ""
  1132. end
  1133. end
  1134. end))
  1135.  
  1136. local done = false
  1137. local x = 0
  1138. local y = 0
  1139.  
  1140. for i,b in pairs(creativeInventory) do
  1141. local display = ""
  1142. if b.displayTex == "" then
  1143. display = b.frontTex
  1144. else
  1145. if b.displayTex then
  1146. display = b.displayTex
  1147. end
  1148. end
  1149. putInventorySlot(UDim2.new(0.5, (x*36) + 8, 0.5, (y*36) + 28), display, creativeInv, 4).MouseButton1Down:connect(function()
  1150. if draggingBlock == nil then
  1151. draggingBlock = b
  1152. end
  1153. end)
  1154. x = x + 1
  1155. if x >= 8 then
  1156. x = 0
  1157. y = y + 1
  1158. end
  1159. end
  1160. if x == 0 then done = true end
  1161. while x < 8 and done == false do
  1162. putInventorySlot(UDim2.new(0.5, (x*36) + 8, 0.5, (y*36) + 28), "", creativeInv, 4)
  1163. x = x + 1
  1164. end
  1165. for i = 1, 9 do
  1166. if toolBar[i] ~= nil then
  1167. local invSlot = putInventorySlot(UDim2.new(0, 8 + ((i-1)*36), 0, 360), toolBar[i].frontTex, creativeInv, 4)
  1168. invSlot.MouseButton2Down:connect(function()
  1169. local imgLabel = invSlot:FindFirstChild("ImageLabel")
  1170. if imgLabel then
  1171. toolBar[i] = nil
  1172. imgLabel.Image = ""
  1173. end
  1174. end)
  1175. invSlot.MouseButton1Down:connect(function()
  1176. --updateHand = true
  1177. local imgLabel = invSlot:FindFirstChild("ImageLabel")
  1178. if toolBar[i] == nil then
  1179. toolBar[i] = draggingBlock
  1180. imgLabel.Image = draggingBlock.frontTex
  1181. draggingBlock = nil
  1182. return
  1183. end
  1184. if toolBar[i] ~= nil and draggingBlock == nil then
  1185. draggingBlock = toolBar[i]
  1186. toolBar[i] = nil
  1187. imgLabel.Image = ""
  1188. return
  1189. elseif toolBar[i] ~= nil and draggingBlock ~= nil then
  1190. --draggingBlock = toolBar[i]
  1191. --toolBar[i] = nil
  1192. imgLabel.Image = ""
  1193. local temp = toolBar[i]
  1194. toolBar[i] = draggingBlock
  1195. if imgLabel and draggingBlock ~= nil then
  1196. imgLabel.Image = draggingBlock.frontTex
  1197. end
  1198. if imgLabel and draggingBlock == nil then
  1199. imgLabel.Image = ""
  1200. end
  1201. draggingBlock = temp
  1202. return
  1203. end
  1204. end)
  1205. else
  1206. local invSlot = putInventorySlot(UDim2.new(0, 8 + ((i-1)*36), 0, 360), "", creativeInv, 4)
  1207. invSlot.MouseButton2Down:connect(function()
  1208. local imgLabel = invSlot:FindFirstChild("ImageLabel")
  1209. if imgLabel then
  1210. toolBar[i] = nil
  1211. imgLabel.Image = ""
  1212. end
  1213. end)
  1214. invSlot.MouseButton1Down:connect(function()
  1215. --updateHand = true
  1216. local imgLabel = invSlot:FindFirstChild("ImageLabel")
  1217. if toolBar[i] == nil then
  1218. toolBar[i] = draggingBlock
  1219. imgLabel.Image = draggingBlock.frontTex
  1220. draggingBlock = nil
  1221. return
  1222. end
  1223. if toolBar[i] ~= nil and draggingBlock == nil then
  1224. draggingBlock = toolBar[i]
  1225. toolBar[i] = nil
  1226. imgLabel.Image = ""
  1227. return
  1228. elseif toolBar[i] ~= nil and draggingBlock ~= nil then
  1229. --draggingBlock = toolBar[i]
  1230. --toolBar[i] = nil
  1231. imgLabel.Image = ""
  1232. local temp = toolBar[i]
  1233. toolBar[i] = draggingBlock
  1234. if imgLabel and draggingBlock ~= nil then
  1235. imgLabel.Image = draggingBlock.frontTex
  1236. end
  1237. if imgLabel and draggingBlock == nil then
  1238. imgLabel.Image = ""
  1239. end
  1240. draggingBlock = temp
  1241. return
  1242. end
  1243. end)
  1244. end
  1245. end
  1246. return creativeInv
  1247. end
  1248. end
  1249. function putToolBarSlot(position, image, zindex)
  1250. local playerGui = player:FindFirstChild("PlayerGui")
  1251. if playerGui then
  1252. local gui = playerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", playerGui)
  1253. gui.Name = "ToolBar"
  1254. local slot = Instance.new("ImageLabel", gui)
  1255. slot.Position = position
  1256. slot.Size = UDim2.new(0, 32, 0, 32)
  1257. slot.BackgroundTransparency = 1
  1258. slot.ImageTransparency = 0
  1259. slot.Image = image
  1260. slot.ZIndex = 2
  1261.  
  1262. local imgSlot = makeImage(UDim2.new(0, 0, 0, 0), UDim2.new(0, 32, 0, 32),
  1263. "rbxassetid://347007448", slot)
  1264.  
  1265. imgSlot.ImageTransparency = 0.25
  1266. imgSlot.BackgroundTransparency = 1
  1267. imgSlot.ImageColor3 = Color3.new(0.225, 0.225, 0.225)
  1268.  
  1269. makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 2, 0, 32),
  1270. Color3.new(0/255, 0/255, 0/255), 0.7, slot)
  1271. makeSquare(UDim2.new(0, 2, 0, 0), UDim2.new(0, 30, 0, 2),
  1272. Color3.new(0/255, 0/255, 0/255), 0.7, slot)
  1273. makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 36, 0, 2),
  1274. Color3.new(106/255, 106/255, 106/255), 0, slot)
  1275. makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 2, 0, 36),
  1276. Color3.new(106/255, 106/255, 106/255), 0, slot)
  1277. makeSquare(UDim2.new(0, 0, 0, 32), UDim2.new(0, 34, 0, 2),
  1278. Color3.new(130/255, 130/255, 130/255), 0, slot)
  1279. makeSquare(UDim2.new(0, 32, 0, 0), UDim2.new(0, 2, 0, 34),
  1280. Color3.new(130/255, 130/255, 130/255), 0, slot)
  1281. makeSquare(UDim2.new(0, -4, 0, -2), UDim2.new(0, 2, 0, 38),
  1282. Color3.new(130/255, 130/255, 130/255), 0, slot)
  1283. makeSquare(UDim2.new(0, 34, 0, -2), UDim2.new(0, 2, 0, 36),
  1284. Color3.new(106/255, 106/255, 106/255), 0, slot)
  1285. makeSquare(UDim2.new(0, -2, 0, 34), UDim2.new(0, 38, 0, 2),
  1286. Color3.new(106/255, 106/255, 106/255), 0, slot)
  1287. makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 40, 0, 2),
  1288. Color3.new(156/255, 156/255, 156/255), 0, slot)
  1289. return slot
  1290. end
  1291. end
  1292. function divide(x, d)
  1293. if x ~= 0 and d ~= 0 then
  1294. return x/d
  1295. else
  1296. return x
  1297. end
  1298. end -- so it doesn't divide by zero
  1299. function getDistance(v1, v2)
  1300. return math.abs((Vector3.new(math.abs(v2.X - v1.X), math.abs(v2.Y - v1.Y), math.abs(v2.Z - v1.Z))).Magnitude)
  1301. end
  1302. function SnapToGrid(x, gridX)
  1303. local x = math.floor((x / gridX) + 0.5) * gridX
  1304. return x
  1305. end
  1306. function round(x)
  1307. if x%2 ~= 0.5 then
  1308. return math.floor(x+0.5)
  1309. end
  1310. return x-0.5
  1311. end
  1312. function weldTo(part1, part2)
  1313. local weld = Instance.new("Weld", part1)
  1314. weld.Part0 = part1
  1315. weld.Part1 = part2
  1316. return weld
  1317. end
  1318. function getMagnitudeXZ(velocity)
  1319. return math.sqrt(math.abs(velocity.X)^2 + math.abs(velocity.Z)^2)
  1320. end
  1321. function findHumanoid(inst)
  1322. local find = inst
  1323. local hum = nil
  1324. repeat
  1325. if find.Name == "Workspace" then return nil end
  1326. find = find.Parent
  1327. hum = find:FindFirstChild("Humanoid")
  1328. until hum
  1329. --if hum then print("found!!") else print("aw... not found") end
  1330. --if hum.ClassName ~= "Humanoid" then hum = nil end
  1331. return hum
  1332. end
  1333. function getSideByLocation(loc)
  1334. local side = nil
  1335. if loc.X < 0 then side = "Left" end
  1336. if loc.X > 0 then side = "Right" end
  1337. if loc.Y > 0 then side = "Top" end
  1338. if loc.Y < 0 then side = "Bottom" end
  1339. if loc.Z < 0 then side = "Front" end
  1340. if loc.Z > 0 then side = "Back" end
  1341.  
  1342. if (math.abs(loc.X) > 0 and math.abs(loc.Y) > 0) or
  1343. (math.abs(loc.X) > 0 and math.abs(loc.Z) > 0) or
  1344. (math.abs(loc.Y) > 0 and math.abs(loc.Z) > 0)
  1345. then
  1346. return nil
  1347. end
  1348. return side
  1349. end
  1350. function getSideByLocationRedstone(loc)
  1351. local side = nil
  1352. if loc.X < 0 then side = "Left" end
  1353. if loc.X > 0 then side = "Right" end
  1354. if loc.Y > 0 then side = "Top" end
  1355. if loc.Y < 0 then side = "Bottom" end
  1356. if loc.Z < 0 then side = "Front" end
  1357. if loc.Z > 0 then side = "Back" end
  1358.  
  1359. if (math.abs(loc.X) > 0 and math.abs(loc.Y) > 0) or
  1360. (math.abs(loc.X) > 0 and math.abs(loc.Z) > 0) or
  1361. (math.abs(loc.Y) > 0 and math.abs(loc.Z) > 0)
  1362. then
  1363. return nil
  1364. end
  1365. return side
  1366. end
  1367. function getBlockAtRegion(region)
  1368. local blockFound = nil
  1369. for _,part in pairs(game.Workspace:FindPartsInRegion3(region, nil, math.huge)) do
  1370. local usePart = true
  1371. if part.Name == "Debris" then usePart = false end
  1372. if usePart == true then
  1373. blockFound = part
  1374. break
  1375. end
  1376. end
  1377. return blockFound
  1378. end
  1379. function getRedstoneAtRegion(region)
  1380. local blockFound = nil
  1381. for _,part in pairs(game.Workspace:FindPartsInRegion3(region, nil, math.huge)) do
  1382. if isRedstone(part) then
  1383. blockFound = part
  1384. break
  1385. end
  1386. end
  1387. return blockFound
  1388. end
  1389. function isRedstone(block)
  1390. local objType = block:FindFirstChild("ObjectType")
  1391. if objType then
  1392. if objType.Value == "Redstone Dust" then
  1393. return true
  1394. else
  1395. return false
  1396. end
  1397. end
  1398. end
  1399. function updateRedstoneDust(dust, leftBlk, rightBlk, topBlk, bottomBlk, frontBlk, backBlk, recursion)
  1400. local objType = nil
  1401. if dust then
  1402. objType = dust:FindFirstChild("ObjectType")
  1403. end
  1404.  
  1405. local redstoneDust = "rbxassetid://151911305"
  1406. local redstoneLine = "rbxassetid://151907047"
  1407. local redstoneCorner = "rbxassetid://151907106"
  1408. local redstoneT = "rbxassetid://151907156"
  1409. local redstoneCross = "rbxassetid://151906997"
  1410.  
  1411. local Rotation = 0
  1412.  
  1413. local theresRedstoneAtLeft = false
  1414. local theresRedstoneAtRight = false
  1415. local theresRedstoneAtFront = false
  1416. local theresRedstoneAtBack = false
  1417.  
  1418. if leftBlk then theresRedstoneAtLeft = isRedstone(leftBlk) end
  1419. if rightBlk then theresRedstoneAtRight = isRedstone(rightBlk) end
  1420. if frontBlk then theresRedstoneAtFront = isRedstone(frontBlk) end
  1421. if backBlk then theresRedstoneAtBack = isRedstone(backBlk) end
  1422.  
  1423. if objType then
  1424. if objType.Value == "Redstone Dust" then
  1425. local topDecal = dust:FindFirstChild("Top")
  1426. if topDecal then
  1427. if theresRedstoneAtBack == false and theresRedstoneAtFront == false and
  1428. theresRedstoneAtLeft == false and theresRedstoneAtRight == false then
  1429. topDecal.Texture = redstoneDust
  1430. Rotation = 0
  1431. end
  1432.  
  1433. if theresRedstoneAtLeft == true or theresRedstoneAtRight == true then
  1434. topDecal.Texture = redstoneLine
  1435. Rotation = 0
  1436. end
  1437.  
  1438. if theresRedstoneAtFront == true or theresRedstoneAtBack == true then
  1439. topDecal.Texture = redstoneLine
  1440. Rotation = 90
  1441. end
  1442.  
  1443. if theresRedstoneAtLeft == true and theresRedstoneAtBack == true then
  1444. topDecal.Texture = redstoneCorner
  1445. Rotation = 0
  1446. end
  1447.  
  1448. if theresRedstoneAtBack == true and theresRedstoneAtRight == true then
  1449. topDecal.Texture = redstoneCorner
  1450. Rotation = 90
  1451. end
  1452.  
  1453. if theresRedstoneAtRight == true and theresRedstoneAtFront == true then
  1454. topDecal.Texture = redstoneCorner
  1455. Rotation = 180
  1456. end
  1457.  
  1458. if theresRedstoneAtFront == true and theresRedstoneAtLeft == true then
  1459. topDecal.Texture = redstoneCorner
  1460. Rotation = -90
  1461. end
  1462.  
  1463. if theresRedstoneAtBack == true and theresRedstoneAtLeft == true
  1464. and theresRedstoneAtFront == true then
  1465. topDecal.Texture = redstoneT
  1466. Rotation = -90
  1467. end
  1468.  
  1469. if theresRedstoneAtLeft == true and theresRedstoneAtFront == true
  1470. and theresRedstoneAtRight == true then
  1471. topDecal.Texture = redstoneT
  1472. Rotation = -180
  1473. end
  1474.  
  1475. if theresRedstoneAtFront == true and theresRedstoneAtRight == true
  1476. and theresRedstoneAtBack == true then
  1477. topDecal.Texture = redstoneT
  1478. Rotation = 90
  1479. end
  1480.  
  1481. if theresRedstoneAtRight == true and theresRedstoneAtBack == true
  1482. and theresRedstoneAtLeft == true then
  1483. topDecal.Texture = redstoneT
  1484. Rotation = 0
  1485. end
  1486.  
  1487. if theresRedstoneAtLeft == true and theresRedstoneAtRight == true and
  1488. theresRedstoneAtFront == true and theresRedstoneAtBack == true then
  1489. topDecal.Texture = redstoneCross
  1490. Rotation = 0
  1491. end
  1492. end
  1493. else
  1494. error("Not redstone dust.")
  1495. end
  1496. end
  1497.  
  1498. if recursion == true then
  1499. local function updateTex(blockTarget)
  1500. local leftSide = nil
  1501. local rightSide = nil
  1502. local frontSide = nil
  1503. local backSide = nil
  1504.  
  1505. local Point1 = blockTarget.CFrame.p - Vector3.new(2.6, 0.1, 2.6)
  1506. local Point2 = blockTarget.CFrame.p + Vector3.new(2.6, 0.1, 2.6)
  1507. local Region = Region3.new(Point1, Point2)
  1508. for _,part in pairs(game.Workspace:FindPartsInRegion3(
  1509. Region,
  1510. nil,
  1511. math.huge
  1512. )) do
  1513. local objType = part:FindFirstChild("ObjectType")
  1514. if isRedstone(part) then
  1515. local side = getSideByLocationRedstone(blockTarget.CFrame.p - part.CFrame.p)
  1516. if side == "Left" then
  1517. leftSide = part
  1518. elseif side == "Right" then
  1519. rightSide = part
  1520. elseif side == "Front" then
  1521. frontSide = part
  1522. elseif side == "Back" then
  1523. backSide = part
  1524. elseif side == "Left Top" then
  1525. leftSide = part
  1526. elseif side == "Right Top" then
  1527. rightSide = part
  1528. elseif side == "Front Top" then
  1529. frontSide = part
  1530. elseif side == "Back Top" then
  1531. backSide = part
  1532. elseif side == "Left Bottom" then
  1533. leftSide = part
  1534. elseif side == "Right Bottom" then
  1535. rightSide = part
  1536. elseif side == "Front Bottom" then
  1537. frontSide = part
  1538. elseif side == "Back Bottom" then
  1539. backSide = part
  1540. end
  1541. end
  1542. end
  1543.  
  1544. updateRedstoneDust(blockTarget, leftSide, rightSide, nil, nil, frontSide, backSide, false)
  1545. end
  1546. if leftBlk and theresRedstoneAtLeft then updateTex(leftBlk) end
  1547. if rightBlk and theresRedstoneAtRight then updateTex(rightBlk) end
  1548. if frontBlk and theresRedstoneAtFront then updateTex(frontBlk) end
  1549. if backBlk and theresRedstoneAtBack then updateTex(backBlk) end
  1550. end
  1551.  
  1552. if dust then dust.CFrame = CFrame.new(dust.CFrame.p.X, dust.CFrame.p.Y, dust.CFrame.p.Z) * CFrame.Angles(0, math.rad(Rotation), 0) end
  1553. end
  1554. function placeBlock(block, cFPos, Mouse)
  1555. if block == nil then
  1556. if Mouse.Target.Size.X <= 10 and Mouse.Target.Size.Y <= 10 and Mouse.Target.Size.Z <= 10 and Mouse.Target then
  1557. if Mouse.Target.Parent.Name ~= "Camera" then
  1558. --print(Mouse.Target:GetFullName())
  1559. local blkTar = Mouse.Target
  1560. --Mouse.Target.Parent = nil
  1561. local blockIsRedstone = isRedstone(blkTar)
  1562.  
  1563. local Point1 = blkTar.CFrame.p - Vector3.new(2.7, 2.7, 2.7)
  1564. local Point2 = blkTar.CFrame.p + Vector3.new(2.7, 2.7, 2.7)
  1565. local Region = Region3.new(Point1, Point2)
  1566. for _,part in pairs(game.Workspace:FindPartsInRegion3(
  1567. Region,
  1568. nil,
  1569. math.huge
  1570. )) do
  1571.  
  1572. if part:FindFirstChild("IsBlock") then
  1573. local side1 = getSideByLocation(blkTar.CFrame.p - part.CFrame.p)
  1574. if getSideByLocation(blkTar.CFrame.p - part.CFrame.p) then
  1575. local texture = part:FindFirstChild(side1)
  1576. if texture then
  1577. texture.Transparency = 0
  1578. end
  1579. end
  1580. end
  1581. end
  1582.  
  1583. for i = 1, 9 do
  1584. local part = Instance.new("Part", workspace)
  1585. part.Size = Vector3.new(0, 0, 0)
  1586. part.Transparency = 1
  1587. part.CanCollide = false
  1588. part.Velocity = Vector3.new(math.random(-5, 5), 5, math.random(-5, 5))
  1589. part.Name = "Debris"
  1590.  
  1591. part.CFrame =
  1592. Mouse.Target.CFrame *
  1593. 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))
  1594.  
  1595. part.CustomPhysicalProperties = PhysicalProperties.new(0, 0.2, 0, 100, 100)
  1596.  
  1597. local billboard = Instance.new("BillboardGui", part)
  1598. billboard.Size = UDim2.new(1.2, 0, 1.2, 0)
  1599.  
  1600. local clipDescendant = Instance.new("TextLabel", billboard)
  1601. clipDescendant.Size = UDim2.new(0.5, 0, 0.5, 0)
  1602. clipDescendant.BackgroundTransparency = 1
  1603. clipDescendant.Text = ""
  1604. clipDescendant.ClipsDescendants = true
  1605.  
  1606. local img = Instance.new("ImageLabel", clipDescendant)
  1607. img.Size = UDim2.new(2, 0, 2, 0)
  1608. img.BackgroundTransparency = 1
  1609. img.Position = UDim2.new(math.random(-70, 70)/100, 0, math.random(-70, 70)/100, 0)
  1610.  
  1611. local tex = blkTar:FindFirstChild("Front")
  1612. if tex then
  1613. img.Image = tex.Texture
  1614. else
  1615. img.Image = "rbxassetid://744949545"
  1616. end
  1617.  
  1618. if img.Image == "rbxassetid://744949545" then
  1619. img.ImageColor3 = blkTar.Color
  1620. end
  1621.  
  1622. part.Touched:connect(function(prt)
  1623. if prt ~= blkTar then
  1624. part.CanCollide = true
  1625. end
  1626. end)
  1627.  
  1628. coroutine.resume(coroutine.create(function()
  1629. wait(math.random(50, 65)/100)
  1630. part:Destroy()
  1631. end))
  1632. --part.Anchored = false
  1633. end
  1634. blkTar:Destroy()
  1635. if blockIsRedstone == true then
  1636. local leftSide = nil
  1637. local rightSide = nil
  1638. local frontSide = nil
  1639. local backSide = nil
  1640.  
  1641. local Point1 = blkTar.CFrame.p - Vector3.new(2.6, 0.1, 2.6)
  1642. local Point2 = blkTar.CFrame.p + Vector3.new(2.6, 0.1, 2.6)
  1643. local Region = Region3.new(Point1, Point2)
  1644. for _,part in pairs(game.Workspace:FindPartsInRegion3(
  1645. Region,
  1646. nil,
  1647. math.huge
  1648. )) do
  1649. local objType = part:FindFirstChild("ObjectType")
  1650. if isRedstone(part) then
  1651. local side = getSideByLocationRedstone(blkTar.CFrame.p - part.CFrame.p)
  1652. if side == "Left" then
  1653. leftSide = part
  1654. elseif side == "Right" then
  1655. rightSide = part
  1656. elseif side == "Front" then
  1657. frontSide = part
  1658. elseif side == "Back" then
  1659. backSide = part
  1660. elseif side == "Left Top" then
  1661. leftSide = part
  1662. elseif side == "Right Top" then
  1663. rightSide = part
  1664. elseif side == "Front Top" then
  1665. frontSide = part
  1666. elseif side == "Back Top" then
  1667. backSide = part
  1668. elseif side == "Left Bottom" then
  1669. leftSide = part
  1670. elseif side == "Right Bottom" then
  1671. rightSide = part
  1672. elseif side == "Front Bottom" then
  1673. frontSide = part
  1674. elseif side == "Back Bottom" then
  1675. backSide = part
  1676. end
  1677. end
  1678. end
  1679.  
  1680. updateRedstoneDust(nil, leftSide, rightSide, nil, nil, frontSide, backSide, true)
  1681. end
  1682. end
  1683. end
  1684. return nil
  1685. else
  1686. local blkMouseTarget = Mouse.Target
  1687.  
  1688. local blockPlaced = Instance.new("Part", workspace)
  1689. blockPlaced.Material = "Fabric"
  1690. blockPlaced.Transparency = block.transparency
  1691. blockPlaced.Anchored = true
  1692. blockPlaced.Size = block.size
  1693.  
  1694. blockPlaced.CFrame = cFPos
  1695.  
  1696. local blockType = Instance.new("StringValue", blockPlaced)
  1697. blockType.Name = "ObjectType"
  1698. blockType.Value = block.objectType
  1699.  
  1700. blockPlaced.Name = block.name
  1701. putTexture(blockPlaced, block.frontTex, block.backTex,
  1702. block.topTex, block.bottomTex, block.leftTex, block.rightTex, "Texture")
  1703.  
  1704. if block.objectType == "Slab" then
  1705. blockPlaced.Size = blockPlaced.Size / Vector3.new(1, 2, 1)
  1706. blockPlaced.CFrame = blockPlaced.CFrame * CFrame.new(0, -blockPlaced.Size.Y/2, 0)
  1707. elseif block.objectType == "Redstone Dust" then
  1708. blockPlaced.CFrame = blockPlaced.CFrame * CFrame.new(0, -1.3, 0)
  1709. blockPlaced.CanCollide = false
  1710.  
  1711. local canPlace = false
  1712.  
  1713. if isRedstone(blkMouseTarget) == true then
  1714. blockPlaced:Destroy()
  1715. return
  1716. end
  1717.  
  1718. local partBelow = getBlockAtRegion(Region3.new(
  1719. blockPlaced.CFrame.p - Vector3.new(1, 1, 1),
  1720. blockPlaced.CFrame.p + Vector3.new(1, 1, 1)
  1721. ))
  1722.  
  1723. if partBelow then
  1724. local targetObjType = partBelow:FindFirstChild("ObjectType")
  1725. if targetObjType then
  1726. if targetObjType.Value == "Block" then
  1727. canPlace = true
  1728. end
  1729. end
  1730. end
  1731.  
  1732. if canPlace == false then
  1733. blockPlaced:Destroy()
  1734. return
  1735. end
  1736.  
  1737. local leftSide = nil
  1738. local rightSide = nil
  1739. local frontSide = nil
  1740. local backSide = nil
  1741.  
  1742. local Point1 = blockPlaced.CFrame.p - Vector3.new(2.6, 0.1, 2.6)
  1743. local Point2 = blockPlaced.CFrame.p + Vector3.new(2.6, 0.1, 2.6)
  1744. local Region = Region3.new(Point1, Point2)
  1745. for _,part in pairs(game.Workspace:FindPartsInRegion3(
  1746. Region,
  1747. nil,
  1748. math.huge
  1749. )) do
  1750. local objType = part:FindFirstChild("ObjectType")
  1751. if isRedstone(part) then
  1752.  
  1753. local side = getSideByLocationRedstone(blockPlaced.CFrame.p - part.CFrame.p)
  1754. if side == "Left" then
  1755. leftSide = part
  1756. elseif side == "Right" then
  1757. rightSide = part
  1758. elseif side == "Front" then
  1759. frontSide = part
  1760. elseif side == "Back" then
  1761. backSide = part
  1762. elseif side == "Left Top" then
  1763. leftSide = part
  1764. elseif side == "Right Top" then
  1765. rightSide = part
  1766. elseif side == "Front Top" then
  1767. frontSide = part
  1768. elseif side == "Back Top" then
  1769. backSide = part
  1770. elseif side == "Left Bottom" then
  1771. leftSide = part
  1772. elseif side == "Right Bottom" then
  1773. rightSide = part
  1774. elseif side == "Front Bottom" then
  1775. frontSide = part
  1776. elseif side == "Back Bottom" then
  1777. backSide = part
  1778. end
  1779.  
  1780.  
  1781. --if getSideByLocation(cFPos.p - part.CFrame.p) then
  1782. -- local texture = part:FindFirstChild(side1)
  1783. -- if texture then
  1784. -- texture.Transparency = 1
  1785. -- end
  1786. --end
  1787. --[[local side2 = getSideByLocation(part.CFrame.p - cFPos.p)
  1788. if getSideByLocation(cFPos.p - part.CFrame.p) then
  1789. local texture = blockPlaced:FindFirstChild(side2)
  1790. if texture then
  1791. texture.Transparency = 1
  1792. end
  1793. end]]
  1794. end
  1795. end
  1796.  
  1797. updateRedstoneDust(blockPlaced, leftSide, rightSide, nil, nil, frontSide, backSide, true)
  1798.  
  1799. --local partBelow = getBlockAtRegion(Region3.new(
  1800. -- blockPlaced.CFrame.p - Vector3.new(1, 1, 1),
  1801. -- blockPlaced.CFrame.p + Vector3.new(1, 1, 1)
  1802. --))
  1803. end
  1804.  
  1805. if Mouse.Target.Name == block.name then
  1806. local targetObjType = Mouse.Target:FindFirstChild("ObjectType")
  1807. if targetObjType then
  1808. if targetObjType.Value == "Slab" then
  1809. local side = Mouse.TargetSurface.Name --getSideByLocation(Mouse.Target.Position - cFPos.p)
  1810. if side == "Bottom" or side == "Top" then
  1811. Mouse.Target.Size = Mouse.Target.Size * Vector3.new(1, 2, 1)
  1812. Mouse.Target.CFrame = Mouse.Target.CFrame * CFrame.new(0, blockPlaced.Size.Y/2, 0)
  1813.  
  1814. targetObjType.Value = "Block"
  1815.  
  1816. blockPlaced:Destroy()
  1817. return
  1818. end
  1819. end
  1820. end
  1821. end
  1822.  
  1823. local Point1 = cFPos.p - Vector3.new(2.7, 2.7, 2.7)
  1824. local Point2 = cFPos.p + Vector3.new(2.7, 2.7, 2.7)
  1825. local Region = Region3.new(Point1, Point2)
  1826. for _,part in pairs(game.Workspace:FindPartsInRegion3(
  1827. Region,
  1828. nil,
  1829. math.huge
  1830. )) do
  1831. local objType = part:FindFirstChild("ObjectType")
  1832. if part:FindFirstChild("IsBlock") and objType then
  1833. local doNothing = false
  1834. if objType.Value == "Slab" or block.objectType == "Slab" then doNothing = true end
  1835. if part.Name == blockPlaced.Name and doNothing == false then
  1836. local side1 = getSideByLocation(cFPos.p - part.CFrame.p)
  1837. if getSideByLocation(cFPos.p - part.CFrame.p) then
  1838. local texture = part:FindFirstChild(side1)
  1839. if texture then
  1840. texture.Transparency = 1
  1841. end
  1842. end
  1843. local side2 = getSideByLocation(part.CFrame.p - cFPos.p)
  1844. if getSideByLocation(cFPos.p - part.CFrame.p) then
  1845. local texture = blockPlaced:FindFirstChild(side2)
  1846. if texture then
  1847. texture.Transparency = 1
  1848. end
  1849. end
  1850. end
  1851. end
  1852. end
  1853.  
  1854.  
  1855. local isBlock = Instance.new("CFrameValue", blockPlaced)
  1856. isBlock.Name = "IsBlock"
  1857.  
  1858. if block.hasGravity == true then
  1859. local connectedTo = Instance.new("ObjectValue", blockPlaced)
  1860. connectedTo.Name = "ConnectedTo"
  1861. blockPlaced.Anchored = false
  1862. blockPlaced.CanCollide = false
  1863. local detector = Instance.new("Part", workspace:WaitForChild("Camera"))
  1864. detector.Transparency = 1
  1865. detector.CanCollide = false
  1866. detector.Size = Vector3.new(1, 0, 1)
  1867. local weldDetector = Instance.new("Motor6D", detector)
  1868. weldDetector.Part0 = detector
  1869. weldDetector.Part1 = blockPlaced
  1870. weldDetector.C1 = CFrame.new(0, -blockPlaced.Size.Y/2, 0)
  1871. local landed = false
  1872. local function fallingBlock()
  1873. coroutine.resume(coroutine.create(function()
  1874. local falling = blockPlaced:FindFirstChild("IsFalling") or Instance.new("CFrameValue", blockPlaced)
  1875. falling.Name = "IsFalling"
  1876. local grav = 0
  1877. while RS:wait() do
  1878. if landed then falling:Destroy() break end
  1879. grav = math.max(-1, grav - 0.0025)
  1880. --blockPlaced.CFrame = CFrame.new(cFPos.X, blockPlaced.CFrame.Y + grav, cFPos.Z)
  1881. end
  1882. end))
  1883. end
  1884. fallingBlock()
  1885. detector.Touched:connect(function(part)
  1886. if blockPlaced.Anchored == false and part ~= blockPlaced and part.Name ~= "Debris" and part:FindFirstChild("IsFalling") == nil and findHumanoid(part) == nil then
  1887. landed = true
  1888. blockPlaced.CanCollide = true
  1889. blockPlaced.Velocity = Vector3.new(0, 0, 0)
  1890. blockPlaced.Anchored = true
  1891. connectedTo.Value = part
  1892. local yOrigin = part.CFrame.Y + (blockPlaced.Size.Y/2) + (part.Size.Y/2)
  1893. blockPlaced.CFrame = CFrame.new(cFPos.X, yOrigin, cFPos.Z)
  1894. --detector:Destroy()
  1895. local falling = false
  1896. part.Changed:connect(function()
  1897. if part.Position.Y ~= yOrigin and falling == false then
  1898. falling = true
  1899. wait(0.075)
  1900. landed = false
  1901. blockPlaced.Anchored = false
  1902. blockPlaced.CanCollide = false
  1903. blockPlaced.Velocity = Vector3.new(0, 0, 0)
  1904. fallingBlock()
  1905. falling = false
  1906. end
  1907. end)
  1908. workspace.ChildRemoved:connect(function()
  1909. --print("hi")
  1910. if connectedTo.Value.Parent == nil and falling == false then
  1911. falling = true
  1912. landed = false
  1913. blockPlaced.Anchored = false
  1914. blockPlaced.CanCollide = false
  1915. blockPlaced.Velocity = Vector3.new(0, 0, 0)
  1916. fallingBlock()
  1917. end
  1918. end)
  1919. end
  1920. end)
  1921. end
  1922.  
  1923. local blockSound = Instance.new("Sound", blockPlaced)
  1924. blockSound.SoundId = block.sound
  1925. blockSound.Volume = block.soundVol
  1926. blockSound.Pitch = math.random(95, 105)/100
  1927. blockSound.PlayOnRemove = true
  1928. blockSound:Play()
  1929. return blockPlaced
  1930. end
  1931. end
  1932. if player then
  1933. local char = player.Character
  1934. if char then
  1935. for _,cM in pairs(char:GetChildren()) do
  1936. if cM.ClassName == "CharacterMesh" then cM:Destroy() end
  1937. end
  1938.  
  1939. --[]
  1940. local gui = player.PlayerGui:FindFirstChild("ToolBar") or Instance.new("ScreenGui", player.PlayerGui)
  1941. gui.Name = "ToolBar"
  1942.  
  1943. makeSquare(UDim2.new(0.5, -166, 1, -111), UDim2.new(0, 364, 0, 2),
  1944. Color3.new(0/255, 0/255, 0/255), 0, gui)
  1945. makeSquare(UDim2.new(0.5, -166, 1, -111 + 42), UDim2.new(0, 364, 0, 2),
  1946. Color3.new(0/255, 0/255, 0/255), 0, gui)
  1947. makeSquare(UDim2.new(0.5, -166, 1, -111), UDim2.new(0, 2, 0, 44),
  1948. Color3.new(0/255, 0/255, 0/255), 0, gui)
  1949. makeSquare(UDim2.new(0.5, -166 + 362, 1, -111), UDim2.new(0, 2, 0, 44),
  1950. Color3.new(0/255, 0/255, 0/255), 0, gui)
  1951.  
  1952. for i = 1, 9 do
  1953. if toolBar[i] ~= nil then
  1954. local img = putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), toolBar[i].frontTex)
  1955. coroutine.resume(coroutine.create(function()
  1956. while wait() do
  1957. if toolBar[i] ~= nil then
  1958. if toolBar[i].displayTex == "" then
  1959. img.Image = toolBar[i].frontTex
  1960. else
  1961. img.Image = toolBar[i].displayTex
  1962. end
  1963. else
  1964. img.Image = ""
  1965. end
  1966. end
  1967. end))
  1968. else
  1969. local img = putToolBarSlot(UDim2.new(0.5, -160 + ((i-1)*40), 1, -105), "")
  1970. coroutine.resume(coroutine.create(function()
  1971. while wait() do
  1972. if toolBar[i] ~= nil then
  1973. if toolBar[i].displayTex == "" then
  1974. img.Image = toolBar[i].frontTex
  1975. else
  1976. img.Image = toolBar[i].displayTex
  1977. end
  1978. else
  1979. img.Image = ""
  1980. end
  1981. end
  1982. end))
  1983. end
  1984. end
  1985.  
  1986. local creativeInventoryGUI = makeInventory()
  1987.  
  1988. local humRootPart = char:WaitForChild("HumanoidRootPart")
  1989. local head = char:WaitForChild("Head")
  1990. local torso = char:WaitForChild("Torso")
  1991. local lArm = char:WaitForChild("Left Arm")
  1992. local rArm = char:WaitForChild("Right Arm")
  1993. local lLeg = char:WaitForChild("Left Leg")
  1994. local rLeg = char:WaitForChild("Right Leg")
  1995.  
  1996. local humanoid = char:WaitForChild("Humanoid")
  1997. char.Humanoid:ClearAllChildren()
  1998. humanoid.HipHeight = 0.3
  1999. humanoid.AutoRotate = false
  2000.  
  2001. -- Heart bar
  2002. local hpFrame = makeSquare(UDim2.new(0.5, -166, 1, -130), UDim2.new(0, 162, 0, 18),
  2003. Color3.new(0/255, 0/255, 0/255), 1, gui, 1)
  2004.  
  2005. local hearts = makeSquare(UDim2.new(0, 0, 0, 0), UDim2.new(0, 162, 0, 18),
  2006. Color3.new(0/255, 0/255, 0/255), 1, hpFrame, 1)
  2007. hearts.ClipsDescendants = true
  2008.  
  2009. for i = 1, 10 do
  2010. local heartImg = makeImage(UDim2.new(0, (i-1)*16, 0, 0), UDim2.new(0, 18, 0, 18),
  2011. "rbxassetid://1494233443", hearts, 2)
  2012.  
  2013. makeSquare(UDim2.new(0, 4, 0, 4), UDim2.new(0, 2, 0, 2),
  2014. Color3.new(255/255, 200/255, 200/255), 0, heartImg, 2)
  2015.  
  2016. heartImg.ImageColor3 = Color3.new(240/255, 0, 0)
  2017.  
  2018. local emptyHeart = makeImage(UDim2.new(0, (i-1)*16, 0, 0), UDim2.new(0, 18, 0, 18),
  2019. "rbxassetid://1494233443", hpFrame, 1)
  2020. emptyHeart.ImageColor3 = Color3.new(0.3, 0.3, 0.3)
  2021.  
  2022. local outline = makeImage(UDim2.new(0, 0, 0, 0), UDim2.new(0, 18, 0, 18),
  2023. "rbxassetid://1494176679", emptyHeart, 1)
  2024. outline.ImageColor3 = Color3.new(0, 0, 0)
  2025.  
  2026. local oldHP = humanoid.Health/humanoid.MaxHealth --SnapToGrid((humanoid.Health/humanoid.MaxHealth)*162, 8)
  2027. humanoid.Changed:connect(function()
  2028. local hp = humanoid.Health/humanoid.MaxHealth --SnapToGrid((humanoid.Health/humanoid.MaxHealth)*162, 8)
  2029. if SnapToGrid(oldHP*162, 8) < SnapToGrid(hp*162, 8) then
  2030. outline.ImageColor3 = Color3.new(1, 1, 1)
  2031. wait(0.1)
  2032. outline.ImageColor3 = Color3.new(0, 0, 0)
  2033. wait(0.1)
  2034. end
  2035. if oldHP > hp then
  2036. for i = 1, 2 do
  2037. outline.ImageColor3 = Color3.new(1, 1, 1)
  2038. wait(0.1)
  2039. outline.ImageColor3 = Color3.new(0, 0, 0)
  2040. wait(0.1)
  2041. end
  2042. end
  2043. oldHP = hp
  2044. end)
  2045. coroutine.resume(coroutine.create(function()
  2046. local yIncrease = 0
  2047. local originalY = emptyHeart.Position.Y.Offset
  2048.  
  2049. while wait() do
  2050. if humanoid.Health/humanoid.MaxHealth <= 0.27 then
  2051. if yIncrease <= 0 then
  2052. yIncrease = math.random(1, 2)
  2053. else
  2054. yIncrease = yIncrease - 1
  2055. end
  2056.  
  2057. heartImg.Position = UDim2.new(0, heartImg.Position.X.Offset, 0, -yIncrease)
  2058. emptyHeart.Position = UDim2.new(0, emptyHeart.Position.X.Offset, 0, -yIncrease)
  2059. else
  2060. if yIncrease >= 1 then
  2061. yIncrease = yIncrease - 1
  2062.  
  2063. heartImg.Position = UDim2.new(0, heartImg.Position.X.Offset, 0, -yIncrease)
  2064. emptyHeart.Position = UDim2.new(0, emptyHeart.Position.X.Offset, 0, -yIncrease)
  2065. end
  2066. end
  2067. end
  2068. end))
  2069. end
  2070.  
  2071. humanoid.Parent = nil
  2072.  
  2073. if char:FindFirstChild("Animate") then
  2074. char.Animate:Remove()
  2075. end
  2076.  
  2077. head.Size = Vector3.new(1.3, 1.3, 1.3)
  2078. putTexture(head, "rbxassetid://38738031", "rbxassetid://36047330",
  2079. "rbxassetid://36047341", "rbxassetid://36047347",
  2080. "rbxassetid://36047323", "rbxassetid://36047315", "Decal")
  2081. head:WaitForChild("Mesh"):Destroy()
  2082. head:WaitForChild("face"):Destroy()
  2083.  
  2084. torso.Size = Vector3.new(1.3, 1.95, 0.65)
  2085. putTexture(torso, "rbxassetid://38934753", "rbxassetid://38934731",
  2086. "rbxassetid://38934780", "rbxassetid://38934740",
  2087. "rbxassetid://38934762", "rbxassetid://38934762", "Decal")
  2088.  
  2089. lArm.Size = Vector3.new(0.65, 1.95, 0.65)
  2090. putTexture(lArm, "rbxassetid://38934581", "rbxassetid://38934560",
  2091. "rbxassetid://38934613", "rbxassetid://38934568",
  2092. "rbxassetid://38934601", "rbxassetid://38934591", "Decal")
  2093.  
  2094. rArm.Size = Vector3.new(0.65, 1.95, 0.65)
  2095. putTexture(rArm, "rbxassetid://38934560", "rbxassetid://38934581",
  2096. "rbxassetid://38934613", "rbxassetid://38934568",
  2097. "rbxassetid://38934601", "rbxassetid://38934591", "Decal")
  2098.  
  2099. lLeg.Size = Vector3.new(0.65, 1.95, 0.65)
  2100. putTexture(lLeg, "rbxassetid://38936226", "rbxassetid://38936209",
  2101. "rbxassetid://38934719", "rbxassetid://38934712",
  2102. "rbxassetid://38936255", "rbxassetid://38936242", "Decal")
  2103.  
  2104. rLeg.Size = Vector3.new(0.65, 1.95, 0.65)
  2105. putTexture(rLeg, "rbxassetid://38936209", "rbxassetid://38936226",
  2106. "rbxassetid://38934719", "rbxassetid://38934712",
  2107. "rbxassetid://38936242", "rbxassetid://38936255", "Decal")
  2108.  
  2109. -- now for the real stuff
  2110. -- |
  2111. -- |
  2112. -- V
  2113. Instance.new("BlockMesh", torso)
  2114. Instance.new("BlockMesh", lArm)
  2115. Instance.new("BlockMesh", rArm)
  2116. Instance.new("BlockMesh", lLeg)
  2117. Instance.new("BlockMesh", rLeg)
  2118.  
  2119. local camera = workspace.Camera
  2120.  
  2121. local camPart = Instance.new("Part", camera)
  2122. camPart.Size = Vector3.new(0, 0, 0)
  2123. camPart.CFrame = camera.CFrame
  2124. camPart.CanCollide = false
  2125. camPart.Anchored = true
  2126. camPart.Transparency = 1
  2127.  
  2128. local cameraHand = Instance.new("Part", camera)
  2129. cameraHand.Size = Vector3.new(0.65, 1.95, 0.65)
  2130. cameraHand.CanCollide = false
  2131. cameraHand.Anchored = true
  2132. cameraHand.Name = "CameraHand"
  2133. putTexture(cameraHand, "rbxassetid://38934560", "rbxassetid://38934581",
  2134. "rbxassetid://38934613", "rbxassetid://38934568",
  2135. "rbxassetid://38934601", "rbxassetid://38934591", "Decal")
  2136.  
  2137. local cameraHandItem = Instance.new("Part", camera)
  2138. cameraHandItem.Name = "CameraHandItem"
  2139. cameraHandItem.Size = Vector3.new(1.1, 1.1, 1.1)
  2140. cameraHandItem.Anchored = true
  2141. cameraHandItem.CanCollide = false
  2142. cameraHandItem.Transparency = 1
  2143.  
  2144. -- welding doesn't really work.
  2145. --local cameraHandWeld = Instance.new("Motor6D", camPart)
  2146. --cameraHandWeld.Part0 = camPart
  2147. --cameraHandWeld.Part1 = cameraHand
  2148. --cameraHandWeld.C0 = CFrame.new(5, 0, 0)
  2149.  
  2150. local rootJoint = torso:FindFirstChild("RootJoint") or Instance.new("Motor6D", torso)
  2151. rootJoint.Name = "RootJoint"
  2152. rootJoint.Part0 = humRootPart
  2153. rootJoint.Part1 = torso
  2154. rootJoint.C1 = CFrame.new(0, 0.05, 0)
  2155.  
  2156. local neck = torso:FindFirstChild("Neck") or Instance.new("Motor6D", torso)
  2157. neck.Name = "Neck"
  2158. neck.Part0 = head
  2159. neck.Part1 = torso
  2160.  
  2161. local lS = torso:FindFirstChild("Left Shoulder") or Instance.new("Motor6D", torso)
  2162. lS.Name = "Left Shoulder"
  2163. lS.Part0 = lArm
  2164. lS.Part1 = torso
  2165. lS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
  2166. lS.C1 = CFrame.new(0.65, 0.975, 0)
  2167.  
  2168. local rS = torso:FindFirstChild("Right Shoulder") or Instance.new("Motor6D", torso)
  2169. rS.Name = "Right Shoulder"
  2170. rS.Part0 = rArm
  2171. rS.Part1 = torso
  2172. rS.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
  2173. rS.C1 = CFrame.new(-0.65, 0.975, 0) * CFrame.Angles(0, -math.rad(180), 0)
  2174.  
  2175. local lH = torso:FindFirstChild("Left Hip") or Instance.new("Motor6D", torso)
  2176. lH.Name = "Left Hip"
  2177. lH.Part0 = lLeg
  2178. lH.Part1 = torso
  2179. lH.C0 = CFrame.new(0, 0.975, 0)
  2180. lH.C1 = CFrame.new(0.325, -0.975, 0) * CFrame.Angles(0, 0, 0)
  2181.  
  2182. local rH = torso:FindFirstChild("Right Hip") or Instance.new("Motor6D", torso)
  2183. rH.Name = "Right Hip"
  2184. rH.Part0 = rLeg
  2185. rH.Part1 = torso
  2186. rH.C0 = CFrame.new(0, 0.975, 0)
  2187. rH.C1 = CFrame.new(-0.325, -0.975, 0) * CFrame.Angles(0, -math.rad(180), 0)
  2188.  
  2189. for _,p in pairs(char:GetChildren()) do
  2190. if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
  2191. local hit = Instance.new("Part", char)
  2192. hit.Name = "DamagePart"
  2193. hit.BrickColor = BrickColor.new("Bright red")
  2194. hit.Material = "SmoothPlastic"
  2195. hit.Transparency = 1
  2196. hit.Size = Vector3.new(p.Size.X + 0.05, p.Size.Y + 0.05, p.Size.Z + 0.05)
  2197. hit.CanCollide = false
  2198. weldTo(hit, p)
  2199. end
  2200. end
  2201.  
  2202. wait(0.25)
  2203.  
  2204. -- local billNameTag = Instance.new("BillboardGui", char)
  2205. -- billNameTag.Size = UDim2.new(1, 0, 1, 0)
  2206. -- billNameTag.Adornee = head
  2207. -- billNameTag.PlayerToHideFrom = player
  2208. --
  2209. -- local textLabel = Instance.new("TextLabel", billNameTag)
  2210. -- textLabel.Font = "Arcade"
  2211. -- --textLabel.Size = UDim2.new(1, 0, 1, 0)
  2212. -- textLabel.TextScaled = true
  2213. -- --textLabel.TextSize = 100
  2214. -- textLabel.Text = targetName
  2215. -- textLabel.Size = UDim2.new(textLabel.TextBounds.X/100, 0, 0.75, 0)
  2216. -- textLabel.BorderSizePixel = 0
  2217. -- textLabel.BackgroundColor3 = Color3.new(0, 0, 0)
  2218. -- textLabel.TextColor3 = Color3.new(1, 1, 1)
  2219. -- textLabel.BackgroundTransparency = 0.5
  2220. --
  2221. -- if textLabel.Text == "Depr1" then
  2222. -- textLabel.TextColor3 = Color3.new(1, 0.75, 0)
  2223. -- end
  2224. --
  2225. -- billNameTag.SizeOffset = Vector2.new(-textLabel.TextBounds.X/200 + 0.5, 0)
  2226. -- billNameTag.StudsOffset = Vector3.new(0, 1.5, 0)
  2227.  
  2228.  
  2229. humanoid.Parent = char
  2230.  
  2231. local ticks = 0
  2232. local times = 0
  2233.  
  2234. local walkAnim = 0
  2235. local increaseWalkAnim = 1
  2236.  
  2237. local idleAnimRotX = 0
  2238. local idleAnimRotZ = 0
  2239. local sneaking = 0
  2240.  
  2241. --local RS = game:GetService("RunService").RenderStepped
  2242. local Mouse = player:GetMouse()
  2243.  
  2244. local oldHP = humanoid.Health
  2245. local damageTime = 0
  2246.  
  2247. local punchRotX = 0
  2248. local punchRotY = 0
  2249. local punchRotZ = 0
  2250. local punchRotXcam = 0
  2251. local punchRotYcam = 0
  2252. local punchRotZcam = 0
  2253. local punchSpeed = 0
  2254. local punching = 0
  2255. local selectedBlock = 8
  2256. local punchEnded = 1
  2257. local itemOnHand = nil
  2258.  
  2259. local selectBox = Instance.new("SelectionBox", camera)
  2260. selectBox.Transparency = 0.5
  2261. selectBox.Color3 = Color3.new(0, 0, 0)
  2262. selectBox.LineThickness = 0
  2263.  
  2264. local handItem = Instance.new("Part", char)
  2265. handItem.Name = "HandItem"
  2266. handItem.Size = Vector3.new(0.52, 0.52, 0.52)
  2267. handItem.Transparency = 1
  2268. handItem.CanCollide = false
  2269.  
  2270. local handItemWeld = Instance.new("Weld", char)
  2271. handItemWeld.Part0 = handItem
  2272. handItemWeld.Part1 = lArm
  2273. handItemWeld.C1 = CFrame.new(0, -0.9, -0.6) * CFrame.Angles(math.rad(-10), math.rad(45), 0)
  2274.  
  2275. local sound = Instance.new("Sound", char)
  2276. sound.Name = "Hurt"
  2277. sound.Volume = 10
  2278. sound.SoundId = "rbxassetid://535690488"
  2279.  
  2280. local facesToResize = {"Front", "Back", "Left", "Right", "Bottom", "Top"}
  2281.  
  2282. local camCurrentZoom = (camera.CFrame.p - head.Position).magnitude
  2283. Mouse.Button1Down:connect(function()
  2284. if punchEnded == 1 then punching = 1 end
  2285. if Mouse.Target then
  2286. if getDistance(head.CFrame.p, Mouse.Hit.p) <= 10.4 then
  2287. local humanoid = Mouse.Target.Parent:FindFirstChild("Humanoid")
  2288. if humanoid then
  2289. humanoid.Health = humanoid.Health - 10
  2290. local parts = Mouse.Target.Parent:GetChildren()
  2291. for _,p in pairs(parts) do
  2292. if p.ClassName == "Part" then
  2293. 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))
  2294. end
  2295. end
  2296. return
  2297. end
  2298. local x = Mouse.Target.CFrame.p.X
  2299. local y = Mouse.Target.CFrame.p.Y
  2300. local z = Mouse.Target.CFrame.p.Z
  2301. if Mouse.TargetSurface.Name == "Right" then x = x + 2.6 end
  2302. if Mouse.TargetSurface.Name == "Left" then x = x - 2.6 end
  2303. if Mouse.TargetSurface.Name == "Top" then y = y + 2.6 end
  2304. if Mouse.TargetSurface.Name == "Bottom" then y = y - 2.6 end
  2305. if Mouse.TargetSurface.Name == "Back" then z = z + 2.6 end
  2306. if Mouse.TargetSurface.Name == "Front" then z = z - 2.6 end
  2307. if Mouse.Target.Size.X > 2.6 or Mouse.Target.Size.Y > 2.6 or Mouse.Target.Size.Z > 2.6 then
  2308. x = Mouse.Hit.p.X
  2309. y = Mouse.Hit.p.Y
  2310. z = Mouse.Hit.p.Z
  2311. end
  2312. -- local x = round(math.abs(mouseX)/2.6)*2.6
  2313. -- local y = round(math.abs(mouseY)/2.6)*2.6
  2314. -- local z = round(math.abs(mouseZ)/2.6)*2.6
  2315. -- if Mouse.Hit.p.X < 0 then x = x * -1 end
  2316. -- if Mouse.Hit.p.Y < 0 then y = y * -1 end
  2317. -- if Mouse.Hit.p.Z < 0 then z = z * -1 end
  2318. local blk = placeBlock(toolBar[selectedBlock + 1], CFrame.new(SnapToGrid(x, 2.6), SnapToGrid(y, 2.6), SnapToGrid(z, 2.6)), Mouse)
  2319. if blk then
  2320. for _,f in pairs(facesToResize) do
  2321. blk:WaitForChild(f).StudsPerTileU = 2.6
  2322. blk:WaitForChild(f).StudsPerTileV = 2.6
  2323. end
  2324. end
  2325. end
  2326. end
  2327. end)
  2328.  
  2329. local changedItem = false
  2330. local hasItemOnHand = 0
  2331. local hi = 0
  2332. -- selection thingy
  2333. local selectLabel = Instance.new("TextLabel", gui)
  2334. selectLabel.Size = UDim2.new(0, 32, 0, 32)
  2335. selectLabel.Position = UDim2.new(0.5, -160 + (selectedBlock*40), 1, -105)
  2336. selectLabel.BackgroundTransparency = 1
  2337. selectLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  2338. selectLabel.BorderSizePixel = 0
  2339. selectLabel.Text = ""
  2340. selectLabel.ZIndex = 3
  2341.  
  2342. makeSquare(UDim2.new(0, -2, 0, 0), UDim2.new(0, 2, 0, 32),
  2343. Color3.new(88/255, 102/255, 85/255), 0, selectLabel, 3)
  2344. makeSquare(UDim2.new(0, -2, 0, -2), UDim2.new(0, 32, 0, 2),
  2345. Color3.new(88/255, 102/255, 85/255), 0, selectLabel, 3)
  2346. makeSquare(UDim2.new(0, -2, 0, 32), UDim2.new(0, 36, 0, 2),
  2347. Color3.new(212/255, 231/255, 207/255), 0, selectLabel, 3)
  2348. makeSquare(UDim2.new(0, 32, 0, 0), UDim2.new(0, 2, 0, 32),
  2349. Color3.new(212/255, 231/255, 207/255), 0, selectLabel, 3)
  2350. makeSquare(UDim2.new(0, 34, 0, -4), UDim2.new(0, 2, 0, 40),
  2351. Color3.new(163/255, 180/255, 159/255), 0, selectLabel, 3)
  2352. makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 2, 0, 40),
  2353. Color3.new(163/255, 180/255, 159/255), 0, selectLabel, 3)
  2354. makeSquare(UDim2.new(0, -4, 0, -4), UDim2.new(0, 40, 0, 2),
  2355. Color3.new(163/255, 180/255, 159/255), 0, selectLabel, 3)
  2356. makeSquare(UDim2.new(0, 32, 0, -2), UDim2.new(0, 2, 0, 2),
  2357. Color3.new(163/255, 180/255, 159/255), 0, selectLabel, 3)
  2358. makeSquare(UDim2.new(0, -4, 0, 34), UDim2.new(0, 40, 0, 2),
  2359. Color3.new(163/255, 180/255, 159/255), 0, selectLabel, 3)
  2360. makeSquare(UDim2.new(0, -6, 0, -6), UDim2.new(0, 2, 0, 42),
  2361. Color3.new(212/255, 231/255, 207/255), 0, selectLabel, 3)
  2362. makeSquare(UDim2.new(0, -6, 0, -6), UDim2.new(0, 42, 0, 2),
  2363. Color3.new(212/255, 231/255, 207/255), 0, selectLabel, 3)
  2364. makeSquare(UDim2.new(0, 36, 0, -4), UDim2.new(0, 2, 0, 40),
  2365. Color3.new(88/255, 102/255, 85/255), 0, selectLabel, 3)
  2366. makeSquare(UDim2.new(0, 36, 0, -6), UDim2.new(0, 2, 0, 2),
  2367. Color3.new(163/255, 180/255, 159/255), 0, selectLabel, 3)
  2368. makeSquare(UDim2.new(0, 38, 0, -6), UDim2.new(0, 2, 0, 44),
  2369. Color3.new(0/255, 0/255, 0/255), 0.3, selectLabel, 3)
  2370. makeSquare(UDim2.new(0, -8, 0, -6), UDim2.new(0, 2, 0, 44),
  2371. Color3.new(0/255, 0/255, 0/255), 0.3, selectLabel, 3)
  2372. makeSquare(UDim2.new(0, -8, 0, -8), UDim2.new(0, 48, 0, 2),
  2373. Color3.new(0/255, 0/255, 0/255), 0, selectLabel, 3)
  2374. --
  2375. local oldItemOnHand = itemOnHand
  2376. function updateItemOnHand()
  2377. for _,d in pairs(handItem:GetChildren()) do
  2378. d:Destroy()
  2379. end
  2380. for _,d in pairs(cameraHandItem:GetChildren()) do
  2381. d:Destroy()
  2382. end
  2383. if itemOnHand ~= nil then
  2384. putTexture(handItem, itemOnHand.frontTex, itemOnHand.backTex,
  2385. itemOnHand.topTex, itemOnHand.bottomTex,
  2386. itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
  2387.  
  2388. putTexture(cameraHandItem, itemOnHand.frontTex, itemOnHand.backTex,
  2389. itemOnHand.topTex, itemOnHand.bottomTex,
  2390. itemOnHand.leftTex, itemOnHand.rightTex, "Texture")
  2391.  
  2392. for _,f in pairs(facesToResize) do
  2393. handItem:WaitForChild(f).StudsPerTileU = 0.52
  2394. handItem:WaitForChild(f).StudsPerTileV = 0.52
  2395. end
  2396.  
  2397. for _,f in pairs(facesToResize) do
  2398. cameraHandItem:WaitForChild(f).StudsPerTileU = 1.1
  2399. cameraHandItem:WaitForChild(f).StudsPerTileV = 1.1
  2400. end
  2401.  
  2402. cameraHand.Transparency = 1
  2403. for _,f in pairs(facesToResize) do
  2404. cameraHand:WaitForChild(f).Transparency = 1
  2405. cameraHand:WaitForChild(f).Transparency = 1
  2406. end
  2407. else
  2408. cameraHand.Transparency = 0
  2409. for _,f in pairs(facesToResize) do
  2410. cameraHand:WaitForChild(f).Transparency = 0
  2411. cameraHand:WaitForChild(f).Transparency = 0
  2412. end
  2413. end
  2414. if oldItemOnHand ~= itemOnHand then
  2415. changedItem = true
  2416. end
  2417. end
  2418.  
  2419. local pressedWTimes = 0
  2420. local sprintingNum = 0
  2421. local sprinting = false
  2422. Mouse.KeyDown:connect(function(key)
  2423. if sprinting == false then sprintingNum = 0 else sprintingNum = 1 end
  2424. if (key == "w" and sprinting == false and sneaking == 0) then
  2425. if pressedWTimes >= 1 or key == Enum.KeyCode.LeftControl then
  2426. sprinting = true
  2427. humanoid.WalkSpeed = humanoid.WalkSpeed * 1.5
  2428. pressedWTimes = 0
  2429. coroutine.resume(coroutine.create(function()
  2430. for i = 1, 24 do
  2431. camera.FieldOfView = camera.FieldOfView + ((24-i)/10)
  2432. RS:wait()
  2433. end
  2434. end))
  2435. end
  2436. pressedWTimes = pressedWTimes + 1
  2437. coroutine.resume(coroutine.create(function()
  2438. for i = 1, 9 do
  2439. if sprinting == true then break end
  2440. wait()
  2441. end
  2442. pressedWTimes = 0
  2443. end))
  2444. end
  2445. if key == "q" and sprinting == false then
  2446. sneaking = 1
  2447. humanoid.WalkSpeed = humanoid.WalkSpeed / 2
  2448. humanoid.HipHeight = humanoid.HipHeight - 0.35
  2449. rootJoint.C1 = CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
  2450. lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0)
  2451. rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
  2452. --print("Sneaking...")
  2453. end
  2454. if key == "e" then
  2455. if creativeInventoryGUI.Visible == true then
  2456. creativeInventoryGUI.Visible = false
  2457. elseif creativeInventoryGUI.Visible == false then
  2458. creativeInventoryGUI.Visible = true
  2459. end
  2460. end
  2461. if key == "1" or key == "2" or key == "3" or
  2462. key == "4" or key == "5" or key == "6" or
  2463. key == "7" or key == "8" or key == "9" then
  2464. selectedBlock = tonumber(key) - 1
  2465. oldItemOnHand = itemOnHand
  2466. itemOnHand = toolBar[tonumber(key)]
  2467. updateItemOnHand()
  2468. if hasItemOnHand == 0 and itemOnHand then hi = 1 end
  2469. if hasItemOnHand == 1 and itemOnHand == nil then hi = 1 end
  2470. end
  2471. --if (key == "0" or key == "1" or key == "2"
  2472. -- or key == "3" or key == "4" or key == "5"
  2473. -- or key == "6" or key == "7") and hasItemOnHand == 0 then hi = 1 end
  2474. selectLabel.Position = UDim2.new(0.5, -160 + ((selectedBlock)*40), 1, -105)
  2475. end)
  2476.  
  2477. local interrump = false
  2478. game:GetService('RunService'):BindToRenderStep('Camera', Enum.RenderPriority.Camera.Value, function()
  2479. if humanoid.Health < oldHP then
  2480. interrump = true
  2481. RS:wait()
  2482. interrump = false
  2483. for i = 1, 15 do
  2484. if interrump == true then interrump = false break end
  2485. camera.CFrame = camera.CFrame * CFrame.Angles(0, 0, -math.rad(15-i))
  2486. RS:wait()
  2487. end
  2488. end
  2489. end)
  2490.  
  2491. local changedPerspective = 0
  2492. Mouse.KeyUp:connect(function(key)
  2493. if sprinting == false then sprintingNum = 0 else sprintingNum = 1 end
  2494. if (key == "w" and sprinting == true and sneaking == 0) then
  2495. sprinting = false
  2496. humanoid.WalkSpeed = humanoid.WalkSpeed / 1.5
  2497. coroutine.resume(coroutine.create(function()
  2498. for i = 1, 24 do
  2499. camera.FieldOfView = camera.FieldOfView - ((24-i)/10)
  2500. RS:wait()
  2501. end
  2502. end))
  2503. end
  2504. if key == "q" and sprinting == false then
  2505. sneaking = 0
  2506. humanoid.WalkSpeed = humanoid.WalkSpeed * 2
  2507. humanoid.HipHeight = humanoid.HipHeight + 0.35
  2508. rootJoint.C1 = CFrame.new(0, 0.05, 0) * CFrame.Angles(0, 0, 0)
  2509. lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0)
  2510. rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(0, 0, 0)
  2511. --print("Stopped sneaking...")
  2512. end
  2513. if key == "r" then
  2514. if changedPerspective == 0 then
  2515. changedPerspective = 1
  2516. camera.CFrame = camera.CFrame * CFrame.Angles(0, math.rad(180), 0)
  2517. elseif changedPerspective == 1 then
  2518. changedPerspective = 0
  2519. camera.CFrame = camera.CFrame * CFrame.Angles(0, math.rad(-180), 0)
  2520. end
  2521. end
  2522. end)
  2523.  
  2524. Mouse.TargetFilter = camera
  2525.  
  2526. local dead = false
  2527. local humOffset = CFrame.new(0, 0, 0)
  2528. local camHandY = 0
  2529. local camHandZ = 0
  2530. local cameraHandCFrame = CFrame.new(1.15, -1.35, -2) * CFrame.fromEulerAnglesXYZ(math.rad(90), math.rad(55), math.rad(20))
  2531. local bodyRot = CFrame.new(0, 0, 0)
  2532. local lastCamRot = camPart.Orientation
  2533. while RS:wait() do
  2534. hearts.Size = UDim2.new(0, SnapToGrid((humanoid.Health/humanoid.MaxHealth)*162, 8) + 2, 0, 18)
  2535. camCurrentZoom = ((CFrame.new(0, -1*sneaking, 0) * camera.CFrame).p - head.Position).magnitude
  2536. if itemOnHand ~= nil then
  2537. hasItemOnHand = 1
  2538. handItem.Transparency = itemOnHand.transparency
  2539. else
  2540. hasItemOnHand = 0
  2541. handItem.Transparency = 1
  2542. end
  2543. if humanoid.Health <= 0 and dead == false then
  2544. dead = true
  2545. local corpseCF = humRootPart.CFrame + Vector3.new(0, -2.925, 0)
  2546. local corpse = Instance.new("Part", workspace)
  2547. corpse.Name = "Dead Corpse"
  2548. corpse.Size = Vector3.new(3, 1, 3)
  2549. corpse.CFrame = corpseCF
  2550. corpse.Transparency = 1
  2551. corpse.CustomPhysicalProperties = PhysicalProperties.new(1, 1, 0, 1, 1)
  2552.  
  2553. local dHead = Instance.new("Part", corpse)
  2554. dHead.CanCollide = false
  2555. dHead.Material = "Fabric"
  2556.  
  2557. local dTorso = Instance.new("Part", corpse)
  2558. dTorso.CanCollide = false
  2559. dTorso.Material = "Fabric"
  2560.  
  2561. local dLArm = Instance.new("Part", corpse)
  2562. dLArm.CanCollide = false
  2563. dLArm.Material = "Fabric"
  2564.  
  2565. local dRArm = Instance.new("Part", corpse)
  2566. dRArm.CanCollide = false
  2567. dRArm.Material = "Fabric"
  2568.  
  2569. local dLLeg = Instance.new("Part", corpse)
  2570. dLLeg.CanCollide = false
  2571. dLLeg.Material = "Fabric"
  2572.  
  2573. local dRLeg = Instance.new("Part", corpse)
  2574. dRLeg.CanCollide = false
  2575. dRLeg.Material = "Fabric"
  2576.  
  2577. dHead.Size = Vector3.new(1.3, 1.3, 1.3)
  2578. putTexture(dHead, "rbxassetid://38738031", "rbxassetid://36047330",
  2579. "rbxassetid://36047341", "rbxassetid://36047347",
  2580. "rbxassetid://36047323", "rbxassetid://36047315", "Decal")
  2581.  
  2582. dTorso.Size = Vector3.new(1.3, 1.95, 0.65)
  2583. putTexture(dTorso, "rbxassetid://38934753", "rbxassetid://38934731",
  2584. "rbxassetid://38934780", "rbxassetid://38934740",
  2585. "rbxassetid://38934762", "rbxassetid://38934762", "Decal")
  2586.  
  2587. dLArm.Size = Vector3.new(0.65, 1.95, 0.65)
  2588. putTexture(dLArm, "rbxassetid://38934581", "rbxassetid://38934560",
  2589. "rbxassetid://38934613", "rbxassetid://38934568",
  2590. "rbxassetid://38934601", "rbxassetid://38934591", "Decal")
  2591.  
  2592. dRArm.Size = Vector3.new(0.65, 1.95, 0.65)
  2593. putTexture(dRArm, "rbxassetid://38934560", "rbxassetid://38934581",
  2594. "rbxassetid://38934613", "rbxassetid://38934568",
  2595. "rbxassetid://38934601", "rbxassetid://38934591", "Decal")
  2596.  
  2597. dLLeg.Size = Vector3.new(0.65, 1.95, 0.65)
  2598. putTexture(dLLeg, "rbxassetid://38936226", "rbxassetid://38936209",
  2599. "rbxassetid://38934719", "rbxassetid://38934712",
  2600. "rbxassetid://38936255", "rbxassetid://38936242", "Decal")
  2601.  
  2602. dRLeg.Size = Vector3.new(0.65, 1.95, 0.65)
  2603. putTexture(dRLeg, "rbxassetid://38936209", "rbxassetid://38936226",
  2604. "rbxassetid://38934719", "rbxassetid://38934712",
  2605. "rbxassetid://38936242", "rbxassetid://38936255", "Decal")
  2606.  
  2607. local weldCorpse = weldTo(dTorso, corpse)
  2608. weldCorpse.C0 = CFrame.new(0, -1.95 - 0.4, 0)
  2609.  
  2610. -- lazy naming...
  2611.  
  2612. local weld1 = weldTo(dTorso, dHead)
  2613. weld1.C0 = CFrame.new(0, 1.625, 0)
  2614.  
  2615. local weld2 = weldTo(dTorso, dLArm)
  2616. weld2.C0 = CFrame.new(0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
  2617. weld2.C1 = CFrame.new(-0.65, 0.975, 0)
  2618.  
  2619. local weld3 = weldTo(dTorso, dRArm)
  2620. weld3.C0 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
  2621. weld3.C1 = CFrame.new(-0.65, 0.975, 0) * CFrame.Angles(0, -math.rad(180), 0)
  2622.  
  2623. local weld4 = weldTo(dTorso, dLLeg)
  2624. weld4.C0 = CFrame.new(0, -0.975, 0)
  2625. weld4.C1 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, 0, 0)
  2626.  
  2627. local weld5 = weldTo(dTorso, dRLeg)
  2628. weld5.C0 = CFrame.new(0, -0.975, 0)
  2629. weld5.C1 = CFrame.new(-0.325, 0.975, 0) * CFrame.Angles(0, -math.rad(180), 0)
  2630.  
  2631. for _,p in pairs(corpse:GetChildren()) do
  2632. if p.ClassName == "Part" then
  2633. local hit = Instance.new("Part", p)
  2634. hit.Name = "DamagePart"
  2635. hit.BrickColor = BrickColor.new("Bright red")
  2636. hit.Material = "SmoothPlastic"
  2637. hit.Transparency = 0.5
  2638. hit.Size = Vector3.new(p.Size.X + 0.05, p.Size.Y + 0.05, p.Size.Z + 0.05)
  2639. hit.CanCollide = false
  2640. weldTo(hit, p)
  2641. end
  2642. end
  2643.  
  2644. head.Parent = nil
  2645. torso.Parent = nil
  2646. lArm.Parent = nil
  2647. rArm.Parent = nil
  2648. lLeg.Parent = nil
  2649. rLeg.Parent = nil
  2650.  
  2651. weldTo(dTorso, humRootPart)
  2652.  
  2653. coroutine.resume(coroutine.create(function()
  2654. for i = 1, 55 do
  2655. corpse.CFrame = corpseCF --*
  2656. --CFrame.Angles(math.rad(-corpse.Orientation.X), 0, math.rad(-corpse.Orientation.Z))
  2657.  
  2658. weldCorpse.C1 = weldCorpse.C1:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, math.rad(90)), 0.075)
  2659. RS:wait()
  2660. end
  2661. for _,p in pairs(corpse:GetChildren()) do
  2662. p:Destroy()
  2663. end
  2664.  
  2665. corpse.Anchored = true
  2666.  
  2667. local smoke = Instance.new("ParticleEmitter", corpse)
  2668. smoke.Size = NumberSequence.new({
  2669. NumberSequenceKeypoint.new(0, 0.6),
  2670. NumberSequenceKeypoint.new(1, 0.6)
  2671. })
  2672. smoke.Texture = "rbxassetid://1494734425"
  2673. smoke.Rate = 100
  2674. smoke.Lifetime = NumberRange.new(0.6, 1.2)
  2675. smoke.Speed = NumberRange.new(2, 5)
  2676. smoke.SpreadAngle = Vector2.new(-30, 30)
  2677.  
  2678. wait(0.07)
  2679.  
  2680. smoke.Enabled = false
  2681.  
  2682. wait(2)
  2683.  
  2684. corpse:Destroy()
  2685. end))
  2686. print("You died!")
  2687. end
  2688. if humanoid.Health < oldHP then
  2689. damageTime = 60
  2690. sound:Play()
  2691. end
  2692. oldHP = humanoid.Health
  2693. if damageTime > 0 and humanoid.Health > 0 then
  2694. for _,p in pairs(char:GetChildren()) do
  2695. if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
  2696. if p.Name == "DamagePart" then
  2697. p.Transparency = 0.5
  2698. end
  2699. end
  2700. end
  2701. damageTime = damageTime - 2
  2702. if damageTime <= 0 then
  2703. for _,p in pairs(char:GetChildren()) do
  2704. if p.Name ~= "HumanoidRootPart" and p.ClassName == "Part" then
  2705. if p.Name == "DamagePart" then
  2706. p.Transparency = 1
  2707. end
  2708. end
  2709. end
  2710. end
  2711. end
  2712. camPart.CFrame = camera.CFrame * CFrame.Angles(0, math.rad(changedPerspective*180), 0)
  2713.  
  2714. if getMagnitudeXZ(torso.Velocity) > 1 then
  2715. if walkAnim >= 1 then
  2716. increaseWalkAnim = -1
  2717. elseif walkAnim <= -1 then
  2718. increaseWalkAnim = 1
  2719. end
  2720. walkAnim = walkAnim + (increaseWalkAnim/(10+(sneaking*20))) * ((5 + getMagnitudeXZ(torso.Velocity))/20)
  2721. else
  2722. walkAnim = 0
  2723. end
  2724.  
  2725. --lH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(-math.rad(sneaking*45), 0, 0)
  2726. --rH.C0 = CFrame.new(0, 0.975, 0) * CFrame.Angles(math.rad(sneaking*45), 0, 0)
  2727. 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)
  2728. 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)
  2729. --
  2730. --rootJoint.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
  2731. --print(math.abs(head.Orientation.Y) - math.abs(humRootPart.Orientation.Y))
  2732. --if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) > 45 then
  2733. --humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(-45 + head.Orientation.Y), 0)
  2734. --print("-45")
  2735. --end
  2736. --if (head.Orientation.Y * 2) - (head.Orientation.Y + torso.Orientation.Y) < -45 then
  2737. --humRootPart.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(45 + head.Orientation.Y), 0)
  2738. --print("45")
  2739. --end
  2740.  
  2741. if changedItem then
  2742. changedItem = false
  2743. coroutine.resume(coroutine.create(function()
  2744. for i = 1, 8 do
  2745. camHandY = camHandY - 0.2
  2746. RS:wait()
  2747. end
  2748. for i = 1, 8 do
  2749. camHandY = camHandY + 0.2
  2750. RS:wait()
  2751. end
  2752. end))
  2753. end
  2754.  
  2755. --move these arms
  2756. rootJoint.C1 = rootJoint.C1:lerp(CFrame.new(0, 0.325, 0) * CFrame.Angles(math.rad(sneaking*45), math.rad(punchRotY), 0), 0.2)
  2757.  
  2758. 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)
  2759. 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)
  2760.  
  2761. if Mouse.Target and getDistance(head.CFrame.p, Mouse.Hit.p) <= 10.4 then
  2762. if Mouse.Target.Parent:FindFirstChild("Humanoid") == nil and Mouse.Target.Parent ~= camera then
  2763. selectBox.Adornee = Mouse.Target
  2764. else
  2765. selectBox.Adornee = nil
  2766. end
  2767. else
  2768. selectBox.Adornee = nil
  2769. end
  2770.  
  2771. --local neckYRot = math.rad(camPart.Orientation.Y - torso.Orientation.Y)
  2772.  
  2773. --neck.C1 = CFrame.new(0, 0.975, 0) * CFrame.fromEulerAnglesXYZ(math.rad(sneaking*45), neckYRot, 0)
  2774. --neck.C0 = CFrame.new(0, -0.65, 0) * CFrame.Angles(-math.rad(camPart.Orientation.X - torso.Orientation.X - (sneaking*45)), 0, 0)
  2775.  
  2776. --print(AngleDifference(camPart.Orientation, torso.Orientation).Y)
  2777.  
  2778. local negate = 1
  2779. if torso.Velocity.Y < 0 then
  2780. negate = -1
  2781. end
  2782.  
  2783. --local vel = math.log(math.abs(torso.Velocity.Y))*negate
  2784. --if vel == math.huge or vel == -math.huge then vel = 0.1 end
  2785. --local vel = torso.Velocity.Y^0.6
  2786.  
  2787. local BobbingY = walkAnim*2
  2788. if BobbingY >= 1 then BobbingY = 1 BobbingY = -BobbingY end
  2789.  
  2790. local rotationSpeed = AngleDifference(camPart.Orientation, lastCamRot)
  2791.  
  2792. local BobbingX = -0.5 + walkAnim
  2793.  
  2794. --cameraHandCFrame = cameraHandCFrame:lerp(CFrame.new(1.15*1.3 + (walkAnim/2 - (walkAnim/4)), -1.35*1.3 + camHandY + (-BobbingY/8) + 0, -0.45 + -camHandZ + ((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)
  2795. cameraHandCFrame = cameraHandCFrame:lerp(CFrame.Angles(math.rad(rotationSpeed.X/1.5), math.rad(rotationSpeed.Y/1.5), math.rad(rotationSpeed.Z/1.5)) * CFrame.new(1.15*1.3 + (BobbingX/3.5), -1.35*1.3 + camHandY + ((0.4-BobbingY)/7) + 0, -0.45 + -camHandZ + ((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)
  2796.  
  2797. humOffset = humOffset:lerp(CFrame.new(walkAnim/4 - (walkAnim/8), BobbingY/13, 0), 0.25)
  2798. humanoid.CameraOffset = Vector3.new(humOffset.X, humOffset.Y, 0)
  2799.  
  2800. cameraHand.CFrame = camPart.CFrame * cameraHandCFrame
  2801.  
  2802. 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)
  2803.  
  2804. if camCurrentZoom >= 1.5 then
  2805. cameraHand.Transparency = 1
  2806. for _,t in pairs(cameraHand:GetChildren()) do
  2807. if t.Transparency == 0 then
  2808. t.Transparency = 1
  2809. end
  2810. end
  2811. for _,t in pairs(cameraHandItem:GetChildren()) do
  2812. if t.Transparency == 0 then
  2813. t.Transparency = 1
  2814. end
  2815. end
  2816. else
  2817. changedPerspective = 0
  2818. cameraHand.Transparency = hasItemOnHand
  2819. for _,t in pairs(cameraHand:GetChildren()) do
  2820. if t.Transparency == 1 then
  2821. t.Transparency = hasItemOnHand
  2822. end
  2823. end
  2824. for _,t in pairs(cameraHandItem:GetChildren()) do
  2825. if t.Transparency == 1 then
  2826. t.Transparency = 0
  2827. end
  2828. end
  2829. end
  2830.  
  2831. if updateHand == true then
  2832. updateHand = false
  2833. updateItemOnHand()
  2834. end
  2835.  
  2836. if punching == 1 and punchEnded == 1 then
  2837. punching = 0
  2838. --print("steve uses punch!!")
  2839. local coPunchCam = coroutine.wrap(function()
  2840. local mult = 2.25
  2841. punchRotXcam = 40/2*mult
  2842. punchRotYcam = 25/2*mult
  2843. camHandZ = 2.5
  2844. wait(0.075/4)
  2845. punchRotXcam = 50/2*mult
  2846. punchRotYcam = 25*mult
  2847. punchRotZcam = -10*mult
  2848. camHandZ = 1
  2849. wait(0.075/4)
  2850. punchRotYcam = 50/1.5*mult
  2851. punchRotXcam = -10*mult
  2852. --wait(0.075/2)
  2853. --punchRotYcam = 50
  2854. --punchRotXcam = -10
  2855. wait(0.02)
  2856. punchRotXcam = -20*mult
  2857. wait(0.055)
  2858. camHandZ = 0
  2859. punchRotXcam = 0
  2860. punchRotYcam = 0
  2861. punchRotZcam = 0
  2862. end)
  2863. local coPunch = coroutine.wrap(function()
  2864. punchEnded = 0
  2865. punchSpeed = 1
  2866. punchRotX = -60
  2867. punchRotY = -8
  2868. punchRotZ = -35
  2869.  
  2870. wait(0.075/1.3)
  2871. punchSpeed = 1
  2872. punchRotX = -75
  2873. punchRotY = 8
  2874. punchRotZ = 40
  2875. wait(0.075/1.3)
  2876. punchSpeed = 1
  2877. punchRotX = -20
  2878. punchRotZ = 40
  2879. wait(0.075/1.3)
  2880. punchSpeed = 3.5
  2881. punchRotX = 0
  2882. punchRotY = 0
  2883. punchRotZ = 0
  2884.  
  2885. punchRotXcam = 0
  2886. punchRotYcam = 0
  2887. punchRotZcam = 0
  2888.  
  2889. punchEnded = 1
  2890. wait(0.06/1.3)
  2891. punchSpeed = 0
  2892. end)
  2893. coPunch()
  2894. coPunchCam()
  2895. end
  2896. if ticks > 20 then
  2897. ticks = 0
  2898. if times == 0 then
  2899. times = times + 1
  2900. idleAnimRotX = -1
  2901. idleAnimRotZ = 0
  2902. elseif times == 1 then
  2903. times = times + 1
  2904. idleAnimRotX = -0.75
  2905. idleAnimRotZ = -0.75
  2906. elseif times == 2 then
  2907. times = times + 1
  2908. idleAnimRotX = 0
  2909. idleAnimRotZ = -1
  2910. elseif times == 3 then
  2911. times = times + 1
  2912. idleAnimRotX = 0.75
  2913. idleAnimRotZ = -0.75
  2914. --idleAnimRotX = 0.75
  2915. --idleAnimRotZ = -0
  2916. elseif times == 4 then
  2917. times = times + 1
  2918. idleAnimRotX = 1
  2919. idleAnimRotZ = 0
  2920. --idleAnimRotX = 1
  2921. --idleAnimRotZ = 0
  2922. elseif times == 5 then
  2923. times = times + 1
  2924. idleAnimRotX = 0.75
  2925. idleAnimRotZ = 0.75
  2926. elseif times == 6 then
  2927. times = times + 1
  2928. idleAnimRotX = 0
  2929. idleAnimRotZ = 1
  2930. elseif times == 7 then
  2931. times = 0
  2932. idleAnimRotX = -0.75
  2933. idleAnimRotZ = 0.75
  2934. end
  2935. end
  2936.  
  2937. if hi == 1 then hi = 0 end
  2938.  
  2939. local rotX = math.deg(math.atan2(humanoid.MoveDirection.Z, humanoid.MoveDirection.X)) + 90
  2940. if humanoid.MoveDirection ~= Vector3.new(0, 0, 0) then
  2941. --print(rotX)
  2942. bodyRot = bodyRot:lerp(CFrame.Angles(0, -math.rad(rotX), 0), 0.125)
  2943. humRootPart.CFrame = CFrame.new(humRootPart.CFrame.p.X, humRootPart.CFrame.p.Y, humRootPart.CFrame.p.Z) * bodyRot
  2944. end
  2945. local neckYRot = math.rad(camPart.Orientation.Y - torso.Orientation.Y)
  2946. neck.C1 = CFrame.new(0, 0.975, 0) * CFrame.fromEulerAnglesXYZ(math.rad(sneaking*45), neckYRot, 0)
  2947. neck.C0 = CFrame.new(0, -0.65, 0) * CFrame.Angles(-math.rad(camPart.Orientation.X - torso.Orientation.X - (sneaking*45)), 0, 0)
  2948.  
  2949. local oldTorsoOrientation = torso.Orientation
  2950. if AngleDifference(camPart.Orientation, torso.Orientation).Y > 45 then
  2951. 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)
  2952. bodyRot = CFrame.Angles(0, math.rad(head.Orientation.Y + 45), 0)
  2953. --print("-45")
  2954. elseif AngleDifference(camPart.Orientation, torso.Orientation).Y < -45 then
  2955. 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)
  2956. bodyRot = CFrame.Angles(0, math.rad(head.Orientation.Y - 45), 0)
  2957. --print("45")
  2958. end
  2959.  
  2960. lastCamRot = camPart.Orientation
  2961. neck.C1 = neck.C1 * CFrame.fromEulerAnglesXYZ(0, -math.rad(AngleDifference(oldTorsoOrientation, torso.Orientation).Y), 0)
  2962. ticks = ticks + 1
  2963. end
  2964. end
  2965. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement