Advertisement
samuelrichter66

minefucked

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