Advertisement
copra50

Minecraft

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