Advertisement
DaOMEGAa32

stove

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