Advertisement
MaxNutellaOML

shd

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