Advertisement
lafur

Untitled

Mar 23rd, 2019
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do print("FE Compatibility code V2 by Mokiros")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 -- // Old(super old) script by wulfbug9.
  6. -- // Cheap brock-copy, made while RMDX was making his :^)
  7. -- // Yeaaaah, Cuddles ftw :>
  8.  
  9. function Part(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat,Ref)
  10.     local p = Instance.new("Part",Parent)
  11.     p.Name = Name
  12.     p.FormFactor = "Custom"
  13.     p.Size = Size
  14.     p.Anchored = Anch
  15.     p.CFrame = CFrame
  16.     p.BrickColor = BrickColor.new(Color)
  17.     p.Transparency = Trans
  18.     p.TopSurface = 0
  19.     p.CanCollide = Can
  20.     p.BottomSurface = 0
  21.     p.Material = Mat
  22.     p.Reflectance = Ref or 0
  23.     p:BreakJoints()
  24.     return p
  25. end
  26. function Mesh(Parent,Type,Scale,Id,Id2)
  27.     local m = Instance.new("SpecialMesh",Parent)
  28.     m.MeshType = Type
  29.     m.Scale = Scale or Vector3.new(1,1,1)
  30.     if Id then
  31.         m.MeshId = Id
  32.         pcall(function()m.TextureId = Id2 end)
  33.     end
  34.     return m
  35. end
  36. function Weld(p1,p2,c0,c1)
  37.     local w = Instance.new("Weld",p1.Parent)
  38.     w.Part0,w.Part1 = p1,p2
  39.     w.C0,w.C1 = c0 or CFrame.new(),c1 or CFrame.new()
  40.     return w
  41. end
  42. function lerp(a,b,c)
  43.     return a+(b-a)*c
  44. end
  45. do
  46.     local function QuaternionFromCFrame(cf)
  47.         local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  48.         local trace = m00 + m11 + m22
  49.         if trace > 0 then
  50.             local s = math.sqrt(1 + trace)
  51.             local recip = 0.5/s
  52.             return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  53.         else
  54.             local i = 0
  55.             if m11 > m00 then
  56.                 i = 1
  57.             end
  58.             if m22 > (i == 0 and m00 or m11) then
  59.                 i = 2
  60.             end
  61.             if i == 0 then
  62.                 local s = math.sqrt(m00-m11-m22+1)
  63.                 local recip = 0.5/s
  64.                 return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  65.             elseif i == 1 then
  66.                 local s = math.sqrt(m11-m22-m00+1)
  67.                 local recip = 0.5/s
  68.                 return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  69.             elseif i == 2 then
  70.                 local s = math.sqrt(m22-m00-m11+1)
  71.                 local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  72.             end
  73.         end
  74.     end  
  75.     local function QuaternionToCFrame(px, py, pz, x, y, z, w)
  76.         local xs, ys, zs = x + x, y + y, z + z
  77.         local wx, wy, wz = w*xs, w*ys, w*zs
  78.         local xx = x*xs
  79.         local xy = x*ys
  80.         local xz = x*zs
  81.         local yy = y*ys
  82.         local yz = y*zs
  83.         local zz = z*zs
  84.         return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
  85.     end  
  86.     local function QuaternionSlerp(a, b, t)
  87.         local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  88.         local startInterp, finishInterp;
  89.         if cosTheta >= 0.0001 then
  90.             if (1 - cosTheta) > 0.0001 then
  91.                 local theta = math.acos(cosTheta)
  92.                 local invSinTheta = 1/math.sin(theta)
  93.                 startInterp = math.sin((1-t)*theta)*invSinTheta
  94.                 finishInterp = math.sin(t*theta)*invSinTheta  
  95.             else
  96.                 startInterp = 1-t
  97.                 finishInterp = t
  98.             end
  99.         else
  100.             if (1+cosTheta) > 0.0001 then
  101.                 local theta = math.acos(-cosTheta)
  102.                 local invSinTheta = 1/math.sin(theta)
  103.                 startInterp = math.sin((t-1)*theta)*invSinTheta
  104.                 finishInterp = math.sin(t*theta)*invSinTheta
  105.             else
  106.                 startInterp = t-1
  107.                 finishInterp = t
  108.             end
  109.         end
  110.         return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
  111.     end  
  112.     function clerp(a,b,t)
  113.         local qa = {QuaternionFromCFrame(a)}
  114.         local qb = {QuaternionFromCFrame(b)}
  115.         local ax, ay, az = a.x, a.y, a.z
  116.         local bx, by, bz = b.x, b.y, b.z
  117.         local _t = 1-t
  118.         return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  119.     end
  120. end
  121. ---------------------------------------------
  122. player = game:service("Players").LocalPlayer
  123. local char
  124. repeat wait() char = player.Character until char
  125. root = char:WaitForChild("HumanoidRootPart")
  126. mouse = player:GetMouse()
  127. step = game:service("RunService").Stepped
  128. Mode = ""
  129. Attacking = false
  130. CurAttack = ""
  131. asset = "http://www.roblox.com/asset/?id="
  132. meshes = {["blast"] = 20329976,["ring"] = 3270017,["spike"] = 1033714,["cone"] = 1082802,["crown"] = 20329976,["cloud"] = 1095708,["diamond"] = 9756362}
  133. sounds = {["gun"] = 131070686;}--
  134. parts = {}
  135. Dead = false
  136. Down = false
  137. Respawned = false
  138. mCombo = {{"Ice","Light blue"},{"Marble","Grey"},{"Brick",Color3.new(97/255,0,0)}}
  139. maxhealthdefault = 5000
  140. maxhealth = 5000 -- default
  141. lastRespawnTime = tick()
  142. minRespawnTime = 20
  143. firstTime = true
  144. headm,headt = "http://www.roblox.com/asset/?id=15881174","http://www.roblox.com/asset/?id=15881163"
  145. name = "Cuddles"
  146. scale = 8
  147. ---------------------------------------------
  148. cf = CFrame.new
  149. ca = CFrame.fromEulerAnglesXYZ
  150. ms = math.sin
  151. mr = math.rad
  152. pi = math.pi
  153. ma = math.abs
  154. mcs = math.cos
  155. v3 = Vector3.new
  156. c3 = Color3.new
  157. bc = BrickColor.new
  158. function rand(a)
  159.     return (math.random()-.5)*2*a
  160. end
  161. function Smoke(origin,dmg,color)
  162.     local partz = Instance.new("Part",workspace)
  163.     partz.Size = Vector3.new(0,0,0)
  164.     partz.FormFactor = "Custom"
  165.     partz.BrickColor = bc(color or "Black")
  166.     partz.CanCollide = false
  167.     partz.TopSurface,partz.BottomSurface = 0,0
  168.     partz.Transparency = 0.25
  169.     partz.CFrame = origin * cf(math.random(-5,5),-1,math.random(-5,5))
  170.     partz:BreakJoints()
  171.     local meshz = Instance.new("SpecialMesh",partz)
  172.     meshz.MeshType = "Sphere"
  173.     meshz.Scale = v3(1.25,1.25,1.25)
  174.     local bpz = Instance.new("BodyPosition",partz)
  175.     bpz.D = 100
  176.     bpz.P = 100
  177.     bpz.position = partz.Position + Vector3.new(0,7,0)
  178.     coroutine.resume(coroutine.create(function(partzz,meshzz)
  179.         for i=25,100 do
  180.             partzz.Transparency = i*0.01
  181.             meshzz.Scale = meshzz.Scale + Vector3.new(0.15,0.1,0.15)
  182.             wait()
  183.         end
  184.         partz:Destroy()
  185.     end),partz,meshz)
  186. end
  187. function brickMagic(origin,color,size)
  188.     local partz = Instance.new("Part",workspace)
  189.     partz.Size = v3(size,size,size)
  190.     partz.FormFactor = "Custom"
  191.     partz.BrickColor = bc(color)
  192.     partz.CanCollide = false
  193.     partz.Anchored = true
  194.     partz.TopSurface,partz.BottomSurface = 0,0
  195.     partz.Transparency = 0.2
  196.     partz.CFrame = (origin * cf(0,-1,0)) * ca(math.random(0,5),math.random(0,5),math.random(0,5))
  197.     partz:BreakJoints()
  198.     local meshz = Instance.new("BlockMesh",partz)
  199.     meshz.Scale = v3(1,1,1)
  200.     coroutine.resume(coroutine.create(function(partzz,m)
  201.         for i=2,10 do
  202.             partzz.CFrame = partzz.CFrame * ca(math.random(0,5),math.random(0,5),math.random(0,5))
  203.             partzz.Transparency = i*0.1
  204.             m.Scale = m.Scale-Vector3.new(.125,.125,.125)
  205.             wait()
  206.         end
  207.         partzz:Destroy()
  208.     end),partz,meshz)
  209. end
  210. function spikeMagic(origin,size,color)
  211.     local partz = Instance.new("Part",workspace)
  212.     partz.FormFactor = "Custom"
  213.     partz.Size = v3(1,1,1)
  214.     partz.BrickColor = bc(color)
  215.     partz.CanCollide = false
  216.     partz.Anchored = true
  217.     partz.TopSurface,partz.BottomSurface = 0,0
  218.     partz.Transparency = 0.2
  219.     partz.CFrame = (origin * cf(0,-1,0))
  220.     partz:BreakJoints()
  221.     local meshz = Instance.new("FileMesh",partz)
  222.     meshz.MeshId = asset..meshes["spike"]
  223.     meshz.Scale = Vector3.new(size/2,size*2,size/2)
  224.     coroutine.resume(coroutine.create(function(partzz,m)
  225.         wait(math.random(4,5))
  226.         for i=0.2,1,.025 do
  227.             partzz.Transparency = i
  228.             wait()
  229.         end
  230.         partzz:Destroy()
  231.     end),partz,meshz)
  232. end
  233. function ringExplode(origin,color,size)
  234.     local partz = Instance.new("Part",workspace)
  235.     partz.FormFactor = "Custom"
  236.     partz.Size = v3(size,size,1)
  237.     partz.BrickColor = bc(color)
  238.     partz.CanCollide = false
  239.     partz.Anchored = true
  240.     partz.TopSurface,partz.BottomSurface = 0,0
  241.     partz.Transparency = 0.2
  242.     partz.CFrame = (origin * cf(0,-1,0))
  243.     partz:BreakJoints()
  244.     local meshz = Instance.new("FileMesh",partz)
  245.     meshz.MeshId = asset..meshes["ring"]
  246.     coroutine.resume(coroutine.create(function(partzz,m)
  247.         for i=0.2,1,.025 do
  248.             partzz.Transparency = i
  249.             m.Scale = m.Scale + v3(.5,.5,0)
  250.             wait()
  251.         end
  252.         partzz:Destroy()
  253.     end),partz,meshz)
  254. end
  255. function placeRock(origin,size)
  256.     local partz = Instance.new("Part",workspace)
  257.     partz.Size = v3(size,size,size)
  258.     partz.FormFactor = "Custom"
  259.     partz.BrickColor = bc("Grey")
  260.     partz.Material = "Marble"
  261.     partz.CanCollide = true
  262.     partz.Anchored = true
  263.     partz.TopSurface,partz.BottomSurface = 0,0
  264.     partz.CFrame = (origin * cf(0,-1,0)) * ca(math.random(0,5),math.random(0,5),math.random(0,5))
  265.     partz:BreakJoints()
  266.     local meshz = Instance.new("BlockMesh",partz)
  267.     meshz.Scale = v3(1,1,1)
  268.     coroutine.resume(coroutine.create(function(partzz,m)
  269.         wait(math.random(4,5))
  270.         for i=0,1,.025 do
  271.             partzz.Transparency = i
  272.             wait()
  273.         end
  274.         partzz:Destroy()
  275.     end),partz,meshz)
  276. end
  277. function placeFirePart(origin,size)
  278.     local partz = Instance.new("Part",workspace)
  279.     partz.FormFactor = "Custom"
  280.     partz.Transparency = 1
  281.     partz.CanCollide = false
  282.     partz.Anchored = true
  283.     partz.TopSurface,partz.BottomSurface = 0,0
  284.     partz.CFrame = (origin * cf(0,-1,0)) * ca(math.random(0,5),math.random(0,5),math.random(0,5))
  285.     partz:BreakJoints()
  286.     local fire = Instance.new("Fire",partz)
  287.     fire.Size = size
  288.     local meshz = Instance.new("BlockMesh",partz)
  289.     meshz.Scale = v3(1,1,1)
  290.     coroutine.resume(coroutine.create(function(fi,partzz)
  291.         wait(math.random(4,5))
  292.         for i=1,fi.Size do
  293.             fi.Size = fi.Size-1
  294.             wait()
  295.         end
  296.         partzz:Destroy()
  297.     end),fire,partz)
  298. end
  299. function quickSound(id,v)
  300.     local s = Instance.new("Sound",workspace)
  301.     s.SoundId = id
  302.     s.PlayOnRemove = true
  303.     s.Volume = v or 1
  304.     delay(0.025,function()s:remove()end)
  305. end
  306. ---------------------------------------------
  307. local respawn
  308. function loadNew(npoint,scl)
  309.     if ((tick()-lastRespawnTime) < minRespawnTime)and not firstTime and not Dead then return end
  310.     lastRespawnTime = tick()
  311.     firstTime = false
  312.     pcall(function()model:Destroy()end)
  313.     local ncombo = mCombo[math.random(1,#mCombo)]
  314.     scale =  scl or scale
  315.     material = ncombo[1]
  316.     color = ncombo[2]
  317.     Mode = ""
  318.     Attacking = false
  319.     CurAttack = ""
  320.     maxhealth = (scl and scl*100)or maxhealthdefault
  321.     start = npoint or root.CFrame * CFrame.new(scale*2,scale*5,0)
  322.     parts = {}
  323.     model = Instance.new("Model",workspace)
  324.     model.Name = name
  325.     rootpart = Part("HumanoidRootPart",model,Vector3.new(2*scale,2*scale,1*scale),start,color,1,false,true,material)
  326.     torso = Part("Torso",model,Vector3.new(2*scale,2*scale,1*scale),start,color,1,false,true,material)
  327.     rootj = Weld(rootpart,torso)
  328.     head = Part("Head",model,Vector3.new(1*scale,1*scale,1*scale),start,color,.9,false,true,material)
  329.     headw = Weld(torso,head,CFrame.new(0,1*scale,0),CFrame.new(0,-.5*scale,0))
  330.     larm = Part("Left Arm",model,Vector3.new(1*scale,(2*scale)/2,1*scale),start,color,1,false,true,material)
  331.     Mesh(larm,"Brick")
  332.     larmw = Weld(torso,larm,CFrame.new(-1.5*scale,0.5*scale,0),CFrame.new(0,.02*scale,0))--CFrame.new(0.5*scale,0.5*scale,0))
  333.     rarm = Part("Right Arm",model,Vector3.new(1*scale,(2*scale)/2,1*scale),start,color,1,false,true,material)
  334.     Mesh(rarm,"Brick")
  335.     rarmw = Weld(torso,rarm,CFrame.new(1.5*scale,.5*scale,0),CFrame.new(0,0.02*scale,0))--CFrame.new(-0.5*scale,0.5*scale,0))
  336.     lleg = Part("Left Leg",model,Vector3.new(1*scale,(2*scale)/2,1*scale),start,color,1,false,true,material)
  337.     Mesh(lleg,"Brick")
  338.     llegw = Weld(torso,lleg,CFrame.new(-.5*scale,-1*scale,0),CFrame.new(0,.53*scale,0))--CFrame.new(-.5*scale,1*scale,0))
  339.     rleg = Part("Right Leg",model,Vector3.new(1*scale,(2*scale)/2,1*scale),start,color,1,false,true,material)
  340.     Mesh(rleg,"Brick")
  341.     rlegw = Weld(torso,rleg,CFrame.new(.5*scale,-1*scale,0),CFrame.new(0,.53*scale,0))--CFrame.new(.5*scale,1*scale,0))
  342.     ------- extra joints (ex: front left arm)
  343.     larml = Part("Left Arm",model,Vector3.new(1*scale,(2*scale)/2,1*scale),start,color,1,false,true,material)
  344.     Mesh(larml,"Brick")
  345.     larmlw = Weld(larm,larml,CFrame.new(0,-0.5*scale,0.5*scale),CFrame.new(0,.5*scale,0.5*scale))
  346.     rarml = Part("Right Arm",model,Vector3.new(1*scale,(2*scale)/2,1*scale),start,color,1,false,true,material)
  347.     Mesh(rarml,"Brick")
  348.     rarmlw = Weld(rarm,rarml,CFrame.new(0,-0.5*scale,0.5*scale),CFrame.new(0,0.5*scale,0.5*scale))
  349.     llegl = Part("Left Leg",model,Vector3.new(1*scale,(2*scale)/2,1*scale),start,color,1,false,true,material)
  350.     Mesh(llegl,"Brick")
  351.     lleglw = Weld(lleg,llegl,CFrame.new(0,-0.5*scale,-0.5*scale),CFrame.new(0,0.5*scale,-0.5*scale))
  352.     rlegl = Part("Right Leg",model,Vector3.new(1*scale,(2*scale)/2,1*scale),start,color,1,false,true,material)
  353.     Mesh(rlegl,"Brick")
  354.     rleglw = Weld(rleg,rlegl,CFrame.new(0,-0.5*scale,-0.5*scale),CFrame.new(0,0.5*scale,-0.5*scale))
  355.     -------
  356.     stand = Part("Stand",torso,Vector3.new(2*scale,2,1*scale),start,color,1,false,true,material)
  357.     standw = Weld(rootpart,stand,CFrame.new(0,-(torso.Size.y+rleg.Size.y),0))
  358.     --------- part making
  359.     -- head
  360.     for x=1,5 do
  361.         for y=1,5 do
  362.             for z=1,5 do
  363.                 local isfacecol = (x==2 and y==4 and z==5 and true)or(x==3 and y==4 and z==5 and true)or
  364.                     (x==4 and y==4 and z==5 and true)or
  365.                     (x==2 and y==2 and z==5 and true)or
  366.                     (x==4 and y==2 and z==5 and true)or false
  367.                 local p = Part("T",model,Vector3.new(scale/5,scale/5,scale/5),torso.CFrame,(isfacecol and "Really black")or color,0,false,false,material)
  368.                 local cf = CFrame.new(x*p.Size.x,y*p.Size.y,z*p.Size.z):inverse()
  369.                 cf = cf * CFrame.new(scale*.6,scale*.6,scale*.6)
  370.                 local w = Weld(head,p,cf*CFrame.Angles(rand(.2),rand(.2),0))
  371.                 table.insert(parts,p)
  372.             end
  373.         end
  374.     end
  375.     -- torso
  376.     local tsx,tsy,tsz = torso.Size.X,torso.Size.Y,torso.Size.Z
  377.     for x=1,3 do
  378.         for y=1,5 do
  379.             for z=1,2 do
  380.                 local p = Part("T",model,Vector3.new(scale/1.5,scale/2.5,scale/2),torso.CFrame,color,0,false,false,material)
  381.                 local cf = CFrame.new(x*p.Size.x,y*p.Size.y,z*p.Size.z):inverse()
  382.                 cf = cf * CFrame.new(scale*1.325,scale*1.2,scale*.75)
  383.                 local w = Weld(torso,p,cf*CFrame.Angles(rand(.2),rand(.2),0))
  384.                 table.insert(parts,p)
  385.             end
  386.         end
  387.     end
  388.     -- la & ra & ll & rl
  389.     for x=1,2 do
  390.         for y=1,2 do
  391.             for z=1,2 do
  392.                 local p = Part("T",model,Vector3.new(scale/2,scale/2,scale/2),torso.CFrame,color,0,false,false,material)
  393.                 local cf = CFrame.new(x*p.Size.x,y*p.Size.y,z*p.Size.z):inverse()
  394.                 cf = cf * CFrame.new(scale*.75,scale*.75,scale*.75)
  395.                 local w = Weld(rarm,p,cf*CFrame.Angles(rand(.2),rand(.2),0))
  396.                 table.insert(parts,p)
  397.                 --------
  398.                 local p = Part("T",model,Vector3.new(scale/2,scale/2,scale/2),torso.CFrame,color,0,false,false,material)
  399.                 local cf = CFrame.new(x*p.Size.x,y*p.Size.y,z*p.Size.z):inverse()
  400.                 cf = cf * CFrame.new(scale*.75,scale*.75,scale*.75)
  401.                 local w = Weld(larm,p,cf*CFrame.Angles(rand(.2),rand(.2),0))
  402.                 table.insert(parts,p)
  403.                 --------
  404.                 local p = Part("T",model,Vector3.new(scale/2,scale/2,scale/2),torso.CFrame,color,0,false,false,material)
  405.                 local cf = CFrame.new(x*p.Size.x,y*p.Size.y,z*p.Size.z):inverse()
  406.                 cf = cf * CFrame.new(scale*.75,scale*.75,scale*.75)
  407.                 local w = Weld(rleg,p,cf*CFrame.Angles(rand(.2),rand(.2),0))
  408.                 table.insert(parts,p)
  409.                 --------
  410.                 local p = Part("T",model,Vector3.new(scale/2,scale/2,scale/2),torso.CFrame,color,0,false,false,material)
  411.                 local cf = CFrame.new(x*p.Size.x,y*p.Size.y,z*p.Size.z):inverse()
  412.                 cf = cf * CFrame.new(scale*.75,scale*.75,scale*.75)
  413.                 local w = Weld(lleg,p,cf*CFrame.Angles(rand(.2),rand(.2),0))
  414.                 table.insert(parts,p)
  415. ------------------------
  416.                 local p = Part("T",model,Vector3.new(scale/2,scale/2,scale/2),torso.CFrame,color,0,false,false,material)
  417.                 local cf = CFrame.new(x*p.Size.x,y*p.Size.y,z*p.Size.z):inverse()
  418.                 cf = cf * CFrame.new(scale*.75,scale*.75,scale*.75)
  419.                 local w = Weld(rarml,p,cf*CFrame.Angles(rand(.2),rand(.2),0))
  420.                 table.insert(parts,p)
  421.                 --------
  422.                 local p = Part("T",model,Vector3.new(scale/2,scale/2,scale/2),torso.CFrame,color,0,false,false,material)
  423.                 local cf = CFrame.new(x*p.Size.x,y*p.Size.y,z*p.Size.z):inverse()
  424.                 cf = cf * CFrame.new(scale*.75,scale*.75,scale*.75)
  425.                 local w = Weld(larml,p,cf*CFrame.Angles(rand(.2),rand(.2),0))
  426.                 table.insert(parts,p)
  427.                 --------
  428.                 local p = Part("T",model,Vector3.new(scale/2,scale/2,scale/2),torso.CFrame,color,0,false,false,material)
  429.                 local cf = CFrame.new(x*p.Size.x,y*p.Size.y,z*p.Size.z):inverse()
  430.                 cf = cf * CFrame.new(scale*.75,scale*.75,scale*.75)
  431.                 local w = Weld(rlegl,p,cf*CFrame.Angles(rand(.2),rand(.2),0))
  432.                 table.insert(parts,p)
  433.                 --------
  434.                 local p = Part("T",model,Vector3.new(scale/2,scale/2,scale/2),torso.CFrame,color,0,false,false,material)
  435.                 local cf = CFrame.new(x*p.Size.x,y*p.Size.y,z*p.Size.z):inverse()
  436.                 cf = cf * CFrame.new(scale*.75,scale*.75,scale*.75)
  437.                 local w = Weld(llegl,p,cf*CFrame.Angles(rand(.2),rand(.2),0))
  438.                 table.insert(parts,p)
  439.             end
  440.         end
  441.     end
  442.     --------- extras
  443.     gunp1 = Part("GunPart1",model,Vector3.new(scale/2,scale/2,scale/2),rarm.CFrame,"Black",0,false,false,"SmoothPlastic")
  444.     gunp1m = Instance.new("CylinderMesh",gunp1)
  445.     gunp1w = Weld(rarml,gunp1,CFrame.new(0,-((rarml.Size.y/2)-(gunp1.Size.y/2)-1),0))
  446.     gunp2 = Part("GunPart1",model,Vector3.new(scale/2,scale/2,scale/2)*1.1,rarm.CFrame,color,0,false,false,"SmoothPlastic")
  447.     gunp1m = Instance.new("CylinderMesh",gunp2)
  448.     gunp2w = Weld(gunp1,gunp2,CFrame.new(0,scale*.05,0))
  449.     gunlight = Instance.new("PointLight",gunp1)
  450.     gunlight.Enabled = false
  451.     gunlight.Color = BrickColor.new("Bright yellow").Color
  452.     gunlight.Range = 2*scale
  453.     ogp1 = gunp1w.C0
  454.     ---------
  455.     game:service("ContentProvider"):Preload(asset..sounds["gun"])
  456.     ---------
  457.     humanoid = Instance.new("Humanoid",model)
  458.     humanoid.Name = "Golem"
  459.     humanoid.MaxHealth = maxhealth
  460.     humanoid.Health = humanoid.MaxHealth
  461.     local numb = humanoid.MaxHealth
  462.     delay(.1,function() -- debug
  463.         for i=1,20 do
  464.             wait()
  465.             humanoid.Health = numb
  466.         end
  467.         wait(1)print(humanoid.Health)
  468.     end)
  469.     oll,orl,ola,ora,oh = llegw.C0,rlegw.C0,larmw.C0,rarmw.C0,headw.C0
  470.     olll,orll,olal,oral = lleglw.C0,rleglw.C0,larmlw.C0,rarmlw.C0
  471.     orac1 = rarmw.C1
  472.     orj = rootj.C0
  473.     table.insert(parts,larm)table.insert(parts,rarm)table.insert(parts,lleg)table.insert(parts,rleg)table.insert(parts,head);
  474.     table.insert(parts,torso)table.insert(parts,rootpart)
  475.     table.insert(parts,larml)table.insert(parts,rarml)table.insert(parts,llegl)table.insert(parts,rlegl)
  476.     ---------
  477.     humanoid.Died:connect(respawn)
  478.     Dead = false
  479.     Respawned = false
  480. end
  481. function respawn()
  482.     Dead = true
  483.     for i,v in pairs(parts)do v.CanCollide = true v:BreakJoints() end
  484.     coroutine.wrap(function()
  485.         wait(5)
  486.         local point = torso.CFrame
  487.         point = CFrame.new(point.x,point.y+30,point.z)
  488.         local nt = {}
  489.         for i,v in pairs(parts)do table.insert(nt,{p=v,pos=point*CFrame.new(0,rand(10),0)}) end
  490.         for i=1,25 do
  491.             wait()
  492.             for _,v in pairs(nt)do
  493.                 pcall(function()
  494.                     v.p.Anchored = true
  495.                     v.p.CFrame = clerp(v.p.CFrame,v.pos,i/25)
  496.                 end)
  497.             end
  498.         end
  499.         for i,v in pairs(parts)do pcall(function()v.Parent = nil end)end
  500.         loadNew(point)
  501.     end)()
  502. end
  503. function Glory() ------------------------- todo
  504.     if Dead or Respawning then return end
  505.     Attacking = true
  506.     CurAttack = "GloryS1"
  507.     local lastt = tick()
  508.     local chargetime = 300
  509.     local num = 0
  510.     local connect
  511.     connect = step:connect(function()
  512.         num = num + 1
  513.         if (tick()-lastt) > .1 then
  514.             lastt = tick()
  515.             brickMagic(head.CFrame*CFrame.new(0,(2*scale)+(scale/2),0),"Really black",scale+2)
  516.         end
  517.         if num > chargetime or Respawned or Dead then
  518.             Attacking = false
  519.             CurAttack = ""
  520.             connect:disconnect()
  521.         end
  522.     end)
  523. end
  524. function Shoot()
  525.     if Dead or Respawning then return end
  526.     Delay(0,function()gunlight.Enabled = true;wait(.1)gunlight.Enabled = false end)
  527.     quickSound(asset..sounds["gun"],.2)
  528.     local start = gunp1.CFrame*CFrame.Angles(-math.pi/2,0,0)
  529.     ringExplode(CFrame.new(start.p,start.p-(start.lookVector*-4)),"Bright yellow",scale)
  530.     local vel = start.lookVector
  531.     local p = Part("Bullet",workspace,Vector3.new((scale>4 and 1)or .5,(scale>4 and 1)or .5,scale),start,color,0.4,true,false,"SmoothPlastic")
  532.     local m = Mesh(p,"Sphere")
  533.     local num = 0
  534.     local ign = model:children()
  535.     local connect
  536.     connect = step:connect(function()
  537.         num = num + 1
  538.         local pp = p.Position
  539.         local h,po
  540.         repeat
  541.             local r = Ray.new(pp,vel.unit*math.min(999.5,vel.magnitude/30+20))
  542.             h,po = workspace:FindPartOnRayWithIgnoreList(r,ign)
  543.             if h then
  544.                 if h.CanCollide then
  545.                     break
  546.                 else
  547.                     table.insert(ign,h)
  548.                     h = nil
  549.                 end
  550.             else
  551.                 break
  552.             end
  553.         until false
  554.         p.CFrame = CFrame.new(po,po+vel)
  555.         if h or num > 300 or Respawned or Dead then
  556.             local cf = p.CFrame
  557.             coroutine.wrap(function(cfz)
  558.                 for i=1,math.random(1,3)do
  559.                     Smoke(cfz,1,color)
  560.                 end
  561.                 if h~=nil then
  562.                     local obj = h.CFrame:pointToObjectSpace(po)
  563.                     local siz = h.Size/2
  564.                     local svec = obj/siz
  565.                     svec = Vector3.new(math.floor(math.abs(svec.X)+.01)*svec.X/math.abs(svec.X),
  566.                         math.floor(math.abs(svec.Y))*svec.Y/math.abs(svec.Y) ,
  567.                         math.floor(math.abs(svec.Z))*svec.Z/math.abs(svec.Z))
  568.                     if svec.magnitude ~= 1 then return end
  569.                     local dir = h.CFrame:vectorToWorldSpace(svec)
  570.                     for i=1,math.random(1,3)do
  571.                         if material=="Ice" then
  572.                             spikeMagic(CFrame.new(po,po-dir)*CFrame.new(math.random(-3,3),0,math.random(-3,3))*CFrame.Angles(math.pi/2,0,0),math.random(scale-2,scale),color)
  573.                         elseif material=="Marble" then
  574.                             placeRock(CFrame.new(po,po-dir)*CFrame.new(math.random(-3,3),0,math.random(-3,3)),math.random(scale-2,scale))
  575.                         elseif material=="Brick" then
  576.                             placeFirePart(CFrame.new(po,po-dir)*CFrame.new(math.random(-3,3),0,math.random(-3,3)),math.random(scale,scale+4))
  577.                         end
  578.                     end
  579.                 end
  580.             end)(cf)
  581.             if h then
  582.                 if h.Parent:FindFirstChild("Humanoid")and h.Parent~=model then
  583.                     h.Parent:FindFirstChild("Humanoid"):TakeDamage(5*(scale/2))
  584.                 elseif h.Parent:FindFirstChild("Golem")and h.Parent~=model then
  585.                     h.Parent:FindFirstChild("Golem"):TakeDamage(50*scale)
  586.                 end
  587.             end
  588.             p:Destroy()
  589.             connect:disconnect()
  590.         end
  591.     end)
  592. end
  593. loadNew()
  594. bg = Instance.new("BodyGyro")
  595. bg.maxTorque = Vector3.new(4e+005,4e+005,4e+005)*math.huge
  596. bg.P = 20e+003
  597. ---------------------------------------------
  598. mouse.KeyDown:connect(function(key)
  599.     key:lower()
  600.     if Dead then return end
  601.     if key=="q" then
  602.         root.CFrame = torso.CFrame*CFrame.new(0,scale*2.5,0)
  603.     elseif key=="l" then
  604.         if CurAttack=="LaserArm" then
  605.             Attacking = false
  606.             CurAttack = ""
  607.         else
  608.             if not Attacking then
  609.                 Attacking = true
  610.                 CurAttack = "LaserArm"
  611.             end
  612.         end
  613.     elseif key=="t" then
  614.         if not Attacking then
  615.             Glory()
  616.         end
  617.     elseif key=="r" then
  618.         Respawned = true
  619.         loadNew()
  620.     elseif key=="x" then
  621.         --Attacking = true
  622.         --CurAttack = "Grab"
  623.     end
  624. end)
  625. mouse.Button1Down:connect(function()
  626.     local targ = mouse.Target
  627.     if targ and not Attacking and not Dead then
  628.         humanoid:MoveTo(mouse.Hit.p,targ)
  629.     elseif Attacking and CurAttack=="LaserArm" then
  630.         Down = true
  631.         while Down and Attacking and CurAttack=="LaserArm" do
  632.             --if not Down or not Attacking or CurAttack~="LaserArm" then break end -- dis debug tho
  633.             wait(.25)
  634.             Shoot()
  635.         end
  636.     end
  637. end)
  638. mouse.Button2Down:connect(function()
  639.     if not Attacking and not Dead then
  640.     --    humanoid:MoveTo(torso.Position,torso)
  641.     end
  642. end)
  643. mouse.Button1Up:connect(function()
  644.     Down = false
  645. end)
  646. player.Chatted:connect(function(msg)
  647.     msg:lower()
  648.     if msg:sub(1,6)=="/scale" then
  649.         if tonumber(msg:sub(8)) < 1 then return end
  650.         local cf = torso.CFrame*CFrame.new(0,tonumber(msg:sub(8))*2,0)
  651.         loadNew(cf,tonumber(msg:sub(8)) or 10)
  652.     end
  653. end)
  654. --------------------------------------------- anims
  655. count = 0
  656. angle = 0
  657. counttime = 70
  658. countspeed = 1
  659. speed = .3
  660.  
  661. step:connect(function()
  662.     if not Dead then
  663.         count = (count%counttime)+countspeed
  664.         angle = math.pi*math.cos((math.pi*2)/counttime*count)
  665.         humanoid.WalkSpeed = (scale > 5 and scale*2)or 10
  666.         rarm.CanCollide,larm.CanCollide,lleg.CanCollide,rleg.CanCollide = true,true,true,true
  667.         for i,v in pairs(parts)do v.CanCollide = true end
  668.         model.Name = name
  669.         torVel = Vector3.new(torso.Velocity.x,0,torso.Velocity.z)
  670.         if not Attacking then
  671.             if torVel.magnitude > 2 then
  672.                 Mode = "Walking"
  673.             elseif torVel.magnitude < 2 then
  674.                 Mode = "Idle"
  675.             end
  676.         else
  677.             humanoid:MoveTo(torso.Position,torso)
  678.             Mode = CurAttack
  679.         end
  680.         if Mode=="Idle" then
  681.             bg.Parent = nil
  682.             speed,countspeed,counttime = .3,.8,100
  683.             gunp1w.C0 = clerp(gunp1w.C0,ogp1,speed)
  684.             rlegw.C0 = clerp(rlegw.C0,orl*CFrame.Angles(angle*speed*.2,0,0),speed)
  685.             rarmw.C0 = clerp(rarmw.C0,ora*CFrame.Angles(-angle*speed*.2+math.abs(angle*.1),0,0),speed)
  686.             rarmw.C1 = clerp(rarmw.C1,orac1,speed)
  687.             llegw.C0 = clerp(llegw.C0,oll*CFrame.Angles(-angle*speed*.2,0,0),speed)
  688.             larmw.C0 = clerp(larmw.C0,ola*CFrame.Angles(angle*speed*.2+math.abs(angle*.1),0,0),speed)
  689.             --------
  690.             rleglw.C0 = clerp(rleglw.C0,orll*CFrame.Angles(angle*speed*.1,0,0),speed)
  691.             rarmlw.C0 = clerp(rarmlw.C0,oral*CFrame.Angles(-angle*speed*.1,0,0),speed)
  692.             lleglw.C0 = clerp(lleglw.C0,olll*CFrame.Angles(-angle*speed*.1,0,0),speed)
  693.             larmlw.C0 = clerp(larmlw.C0,olal*CFrame.Angles(angle*speed*.1,0,0),speed)
  694.             --------
  695.             headw.C0 = clerp(headw.C0,oh*CFrame.Angles(0,0,0),speed)
  696.             rootj.C0 = clerp(rootj.C0,orj*CFrame.Angles(0,0,0),speed)
  697.         elseif Mode=="Walking" then
  698.             bg.Parent = nil
  699.             speed,countspeed,counttime = .5,1,30
  700.             gunp1w.C0 = clerp(gunp1w.C0,ogp1,speed)
  701.             rlegw.C0 = clerp(rlegw.C0,orl*CFrame.Angles(angle*speed*.3,0,0),speed)
  702.             rarmw.C0 = clerp(rarmw.C0,ora*CFrame.Angles(-angle*speed*.3,0,0),speed)
  703.             rarmw.C1 = clerp(rarmw.C1,orac1,speed)
  704.             llegw.C0 = clerp(llegw.C0,oll*CFrame.Angles(-angle*speed*.3,0,0),speed)
  705.             larmw.C0 = clerp(larmw.C0,ola*CFrame.Angles(angle*speed*.3,0,0),speed)
  706.             --------
  707.             rleglw.C0 = clerp(rleglw.C0,orll*CFrame.Angles(-math.abs(angle*speed*.1),0,0),speed)
  708.             rarmlw.C0 = clerp(rarmlw.C0,oral*CFrame.Angles(math.abs(angle*speed*.1),0,0),speed)
  709.             lleglw.C0 = clerp(lleglw.C0,olll*CFrame.Angles(-math.abs(angle*speed*.1),0,0),speed)
  710.             larmlw.C0 = clerp(larmlw.C0,olal*CFrame.Angles(math.abs(angle*speed*.1),0,0),speed)
  711.             --------
  712.             headw.C0 = clerp(headw.C0,oh*CFrame.Angles(0,0,0),speed)
  713.             rootj.C0 = clerp(rootj.C0,orj*CFrame.Angles(0,0,0),speed)
  714.         elseif Mode=="LaserArm" then
  715.             bg.Parent = nil
  716.             speed,countspeed,counttime = .3,.8,100
  717.             local mpos = torso.CFrame * CFrame.new(1.5*scale,0.5*scale,0) -- thx doogle <3
  718.             local cf = CFrame.new(mpos.p,mouse.Hit.p) * CFrame.Angles(math.pi/2,0,0)
  719.             local x,y,z = torso.CFrame:toObjectSpace(cf):toEulerAnglesXYZ()
  720.             gunp1w.C0 = clerp(gunp1w.C0,CFrame.new(0,-((rarm.Size.y/2)+(gunp1.Size.y/2)),0),speed)
  721.             rlegw.C0 = clerp(rlegw.C0,orl*CFrame.Angles(angle*speed*.2,0,0),speed)
  722.             rarmw.C0 = clerp(rarmw.C0,ora*CFrame.Angles(x,y,z),speed)
  723.             llegw.C0 = clerp(llegw.C0,oll*CFrame.Angles(-angle*speed*.2,0,0),speed)
  724.             larmw.C0 = clerp(larmw.C0,ola*CFrame.Angles(angle*speed*.2+math.abs(angle*.1),0,0),speed)
  725.             --------
  726.             rleglw.C0 = clerp(rleglw.C0,orll*CFrame.Angles(angle*speed*.1,0,0),speed)
  727.             rarmlw.C0 = clerp(rarmlw.C0,oral,speed)
  728.             lleglw.C0 = clerp(lleglw.C0,olll*CFrame.Angles(-angle*speed*.1,0,0),speed)
  729.             larmlw.C0 = clerp(larmlw.C0,olal*CFrame.Angles(angle*speed*.05+math.abs(angle*.1),0,0),speed)
  730.             --------
  731.             headw.C0 = clerp(headw.C0,oh*CFrame.Angles(0,0,0),speed)
  732.             rootj.C0 = clerp(rootj.C0,orj*CFrame.Angles(0,0,0),speed)
  733.         elseif Mode=="GloryS1" then
  734.             bg.Parent = nil
  735.             speed,countspeed,counttime = .3,.8,100
  736.             gunp1w.C0 = clerp(gunp1w.C0,ogp1,speed)
  737.             rlegw.C0 = clerp(rlegw.C0,orl*CFrame.Angles(angle*speed*.2,0,0),speed)
  738.             rarmw.C0 = clerp(rarmw.C0,ora*CFrame.Angles(angle*speed*.2-math.pi,0,-.25),speed)
  739.             rarmw.C1 = clerp(rarmw.C1,orac1,speed)
  740.             llegw.C0 = clerp(llegw.C0,oll*CFrame.Angles(-angle*speed*.2,0,0),speed)
  741.             larmw.C0 = clerp(larmw.C0,ola*CFrame.Angles(angle*speed*.1-math.pi,0,.25),speed)
  742.             --------
  743.             rleglw.C0 = clerp(rleglw.C0,orll*CFrame.Angles(angle*speed*.1,0,0),speed)
  744.             rarmlw.C0 = clerp(rarmlw.C0,oral*CFrame.Angles(-angle*speed*.05,0,0),speed)
  745.             lleglw.C0 = clerp(lleglw.C0,olll*CFrame.Angles(-angle*speed*.1,0,0),speed)
  746.             larmlw.C0 = clerp(larmlw.C0,olal*CFrame.Angles(angle*speed*.05,0,0),speed)
  747.             --------
  748.             headw.C0 = clerp(headw.C0,oh*CFrame.Angles(0,0,0),speed)
  749.             rootj.C0 = clerp(rootj.C0,orj*CFrame.Angles(0,0,0),speed)
  750.         elseif Mode=="Grab" then -------------------------------------- todo
  751.             bg.Parent = nil
  752.             speed,countspeed,counttime = .3,.8,100
  753.             gunp1w.C0 = clerp(gunp1w.C0,ogp1,speed)
  754.             rlegw.C0 = clerp(rlegw.C0,orl*CFrame.Angles(0,0,0),speed)
  755.             rarmw.C0 = clerp(rarmw.C0,ora*CFrame.Angles(0,0,0),speed)
  756.             rarmw.C1 = clerp(rarmw.C1,orac1,speed)
  757.             llegw.C0 = clerp(llegw.C0,oll*CFrame.Angles(0,0,0),speed)
  758.             larmw.C0 = clerp(larmw.C0,ola*CFrame.Angles(0,0,0),speed)
  759.             --------
  760.             rleglw.C0 = clerp(rleglw.C0,orll*CFrame.Angles(0,0,0),speed)
  761.             rarmlw.C0 = clerp(rarmlw.C0,oral*CFrame.Angles(0,0,0),speed)
  762.             lleglw.C0 = clerp(lleglw.C0,olll*CFrame.Angles(0,0,0),speed)
  763.             larmlw.C0 = clerp(larmlw.C0,olal*CFrame.Angles(0,0,0),speed)
  764.             --------
  765.             headw.C0 = clerp(headw.C0,oh*CFrame.Angles(0,0,0),speed)
  766.             rootj.C0 = clerp(rootj.C0,orj*CFrame.Angles(0,0,0),speed)
  767.         end
  768.     end
  769. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement