Advertisement
antgame11

Untitled

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