Advertisement
Christoffer07700Extr

STEAVE FROM MINECRAFT FE

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