Advertisement
gdgrg

miencraft

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