copra50

steve

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