Advertisement
Darxiusss

Untitled

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