Upscalefanatic3

Minecraft Script for roblox

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