Advertisement
wulfbawg

CUDDLES.

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