Advertisement
whyumean

Untitled

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