Advertisement
antgame11

Untitled

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