Advertisement
Somidy

Phantom Forces Script (old)

Mar 20th, 2018
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 33.39 KB | None | 0 0
  1. spawn(function()
  2.     local vector={}
  3. local cframe={}
  4. local trash={}
  5. local event={}
  6. local physics={}
  7. local sound={}
  8. local tween={}
  9. local animation={}
  10.  
  11. local replication={}
  12. if not owner then
  13.     owner = game.Players.LocalPlayer
  14. end
  15. local plr = owner
  16. repeat wait(.2) until plr.Character
  17. local char = plr.Character
  18. spawn(function()
  19. for i = 1,10 do
  20.     if char:FindFirstChild("Shirt Graphic") then
  21.         char:FindFirstChild("Shirt Graphic"):Destroy()
  22.     end
  23.     if char:FindFirstChild("Head") then
  24.     char.Head.Color = Color3.fromRGB(255, 255, 255)
  25.     if char.Head:FindFirstChild("face") then
  26.         char.Head.face.Texture = "rbxasset://textures/face.png"
  27.     end
  28.     plr.Character.Humanoid:RemoveAccessories()
  29.     if char:FindFirstChild("Clothing1") then else
  30.         local pants = Instance.new("Pants")
  31. pants.Name = "Clothing1"
  32. pants.PantsTemplate = "http://www.roblox.com/asset/?id=341106594"
  33. pants.Parent = char
  34.     end
  35.         if char:FindFirstChild("Clothing2") then else
  36.         local pants = Instance.new("Shirt")
  37. pants.Name = "Clothing2"
  38. pants.ShirtTemplate = "http://www.roblox.com/asset/?id=399707708"
  39. pants.Parent = char
  40.     end
  41.  
  42.     end
  43.    
  44.    
  45.    
  46.    
  47.     for i,v in pairs(char:GetChildren()) do
  48.         if v.Name == "Clothing1" or v.Name == "Clothing2" then else
  49.         if v.ClassName=="Pants" then
  50.             v:Destroy()
  51.         elseif v.ClassName == "Shirt" then
  52.             v:Destroy()
  53.        
  54.         end
  55.         end
  56.         end
  57. end
  58. end)
  59. local loltimescale=1
  60. local lolgravity=Vector3.new(0,-196.2,0)local loltick=tick
  61. local function tick()
  62.     return loltimescale*loltick()
  63. end
  64.  
  65.  
  66. math.randomseed(tick())
  67. local realprint=print
  68. --local print=function() end
  69.  
  70.  
  71.  
  72. if loltimescale>=2 then
  73.     local s=Instance.new("Sound",game.Workspace)
  74.     s.SoundId="http://roblox.com/asset/?id=145542130"
  75.     s.Looped=true
  76.     s:Play()
  77. end
  78.  
  79.  
  80. do
  81.     local sort          =table.sort
  82.     local atan2         =math.atan2
  83.     local inf           =math.huge
  84.     local cos           =math.cos
  85.     local sin           =math.sin
  86.     local setmetatable  =setmetatable
  87.     local tick          =tick
  88.     local dot           =Vector3.new().Dot
  89.  
  90.     physics.spring      ={}
  91.  
  92.     do
  93.         local cos=math.cos
  94.         local sin=math.sin
  95.         local e=2.718281828459045
  96.         local setmt=setmetatable
  97.         local error=error
  98.         local tostring=tostring
  99.         local tick=tick
  100.    
  101.         local function posvel(d,s,p0,v0,p1,v1,x)
  102.             if s==0 then
  103.                 return p0
  104.             elseif d<1-1e-8 then
  105.                 local h=(1-d*d)^0.5
  106.                 local c1=(p0-p1+2*d/s*v1)
  107.                 local c2=d/h*(p0-p1)+v0/(h*s)+(2*d*d-1)/(h*s)*v1
  108.                 local co=cos(h*s*x)
  109.                 local si=sin(h*s*x)
  110.                 local ex=e^(d*s*x)
  111.                 return co/ex*c1+si/ex*c2+p1+(x-2*d/s)*v1,
  112.                     s*(co*h-d*si)/ex*c2-s*(co*d+h*si)/ex*c1+v1
  113.             elseif d<1+1e-8 then
  114.                 local c1=p0-p1+2/s*v1
  115.                 local c2=p0-p1+(v0+v1)/s
  116.                 local ex=e^(s*x)
  117.                 return (c1+c2*s*x)/ex+p1+(x-2/s)*v1,
  118.                     v1-s/ex*(c1+(s*x-1)*c2)
  119.             else
  120.                 local h=(d*d-1)^0.5
  121.                 local a=(v1-v0)/(2*s*h)
  122.                 local b=d/s*v1-(p1-p0)/2
  123.                 local c1=(1-d/h)*b+a
  124.                 local c2=(1+d/h)*b-a
  125.                 local co=e^(-(h+d)*s*x)
  126.                 local si=e^((h-d)*s*x)
  127.                 return c1*co+c2*si+p1+(x-2*d/s)*v1,
  128.                     si*(h-d)*s*c2-co*(d+h)*s*c1+v1
  129.             end
  130.         end
  131.    
  132.         local function targposvel(p1,v1,x)
  133.             return p1+x*v1,v1
  134.         end
  135.    
  136.         function physics.spring.new(initial)
  137.             local d=1
  138.             local s=1
  139.             local p0=initial or 0
  140.             local v0=0*p0
  141.             local p1=p0
  142.             local v1=v0
  143.             local t0=tick()
  144.    
  145.             local self={}
  146.             local meta={}
  147.    
  148.             function self.getpv()
  149.                 return posvel(d,s,p0,v0,p1,v1,tick()-t0)
  150.             end
  151.    
  152.             function self.setpv(p,v)
  153.                 local time=tick()
  154.                 local tp,tv=targposvel(p1,v1,time-t0)
  155.                 p0,v0=p,v
  156.                 p1,v1=tp,tv
  157.                 t0=time
  158.             end
  159.    
  160.             function self.settargetpv(tp,tv)
  161.                 local time=tick()
  162.                 local p,v=posvel(d,s,p0,v0,p1,v1,time-t0)
  163.                 p0,v0=p,v
  164.                 p1,v1=tp,tv
  165.                 t0=time
  166.             end
  167.            
  168.             function self:accelerate(a)
  169.                 local time=tick()
  170.                 local p,v=posvel(d,s,p0,v0,p1,v1,time-t0)
  171.                 local tp,tv=targposvel(p1,v1,time-t0)
  172.                 p0,v0=p,v+a
  173.                 p1,v1=tp,tv
  174.                 t0=time
  175.             end
  176.    
  177.             function meta.__index(self,index)
  178.                 local time=tick()
  179.                 if index=="p" or index=="position" then
  180.                     local p,v=posvel(d,s,p0,v0,p1,v1,time-t0)
  181.                     return p
  182.                 elseif index=="v" or index=="velocity" then
  183.                     local p,v=posvel(d,s,p0,v0,p1,v1,time-t0)
  184.                     return v
  185.                 elseif index=="tp" or index=="t" or index=="targetposition" then
  186.                     local tp,tv=targposvel(p1,v1,time-t0)
  187.                     return tp
  188.                 elseif index=="tv" or index=="targetvelocity" then
  189.                     local tp,tv=targposvel(p1,v1,time-t0)
  190.                     return tv
  191.                 elseif index=="d" or index=="damper" then
  192.                     return d
  193.                 elseif index=="s" or index=="speed" then
  194.                     return s
  195.                 else
  196.                     error("no value "..tostring(index).." exists")
  197.                 end
  198.             end
  199.    
  200.             function meta.__newindex(self,index,value)
  201.                 local time=tick()
  202.                 if index=="p" or index=="position" then
  203.                     local p,v=posvel(d,s,p0,v0,p1,v1,time-t0)
  204.                     local tp,tv=targposvel(p1,v1,time-t0)
  205.                     p0,v0=value,v
  206.                     p1,v1=tp,tv
  207.                 elseif index=="v" or index=="velocity" then
  208.                     local p,v=posvel(d,s,p0,v0,p1,v1,time-t0)
  209.                     local tp,tv=targposvel(p1,v1,time-t0)
  210.                     p0,v0=p,value
  211.                     p1,v1=tp,tv
  212.                 elseif index=="tp" or index=="t" or index=="targetposition" then
  213.                     local p,v=posvel(d,s,p0,v0,p1,v1,time-t0)
  214.                     local tp,tv=targposvel(p1,v1,time-t0)
  215.                     p0,v0=p,v
  216.                     p1,v1=value,tv
  217.                 elseif index=="tv" or index=="targetvelocity" then
  218.                     local p,v=posvel(d,s,p0,v0,p1,v1,time-t0)
  219.                     local tp,tv=targposvel(p1,v1,time-t0)
  220.                     p0,v0=p,v
  221.                     p1,v1=tp,value
  222.                 elseif index=="d" or index=="damper" then
  223.                     local p,v=posvel(d,s,p0,v0,p1,v1,time-t0)
  224.                     local tp,tv=targposvel(p1,v1,time-t0)
  225.                     p0,v0=p,v
  226.                     p1,v1=tp,tv
  227.                     d=value
  228.                 elseif index=="s" or index=="speed" then
  229.                     local p,v=posvel(d,s,p0,v0,p1,v1,time-t0)
  230.                     local tp,tv=targposvel(p1,v1,time-t0)
  231.                     p0,v0=p,v
  232.                     p1,v1=tp,tv
  233.                     s=value
  234.                 elseif index=="a" or index=="acceleration" then
  235.                     local time=tick()
  236.                     local p,v=posvel(d,s,p0,v0,p1,v1,time-t0)
  237.                     local tp,tv=targposvel(p1,v1,time-t0)
  238.                     p0,v0=p,v+value
  239.                     p1,v1=tp,tv
  240.                     t0=time
  241.                 else
  242.                     error("no value "..tostring(index).." exists")
  243.                 end
  244.                 t0=time
  245.             end
  246.    
  247.             return setmt(self,meta)
  248.         end
  249.     end
  250.  
  251.     local function rootreals4(a,b,c,d,e)
  252.         local x0,x1,x2,x3
  253.         local m10=3*a
  254.         local m0=-b/(4*a)
  255.         local m4=c*c-3*b*d+12*a*e
  256.         local m6=(b*b/(4*a)-2/3*c)/a
  257.         local m9=((b*(4*c-b*b/a))/a-(8*d))/a
  258.         local m5=c*(2*c*c-9*b*d-72*a*e)+27*a*d*d+27*b*b*e
  259.         local m11=m5*m5-4*m4*m4*m4
  260.         local m7
  261.         if m11<0 then--Optimize
  262.             local th=atan2((-m11)^0.5,m5)/3
  263.             local m=((m5*m5-m11)/4)^(1/6)
  264.             m7=(m4/m+m)/m10*cos(th)
  265.         else--MAY NEED CASE FOR WHEN 2*c*c*c-9*b*c*d+27*a*d*d+27*b*b*e-72*a*c*e+((2*c*c*c-9*b*c*d+27*a*d*d+27*b*b*e-72*a*c*e)^2-4*(c*c-3*b*d+12*a*e)^3)^(1/2)=0
  266.             local m8=(m5+m11^0.5)/2
  267.             m8=m8<0 and -(-m8)^(1/3) or m8^(1/3)
  268.             m7=(m4/m8+m8)/m10
  269.         end
  270.         local m2=2*m6-m7
  271.         --print("m2",m2,0)
  272.         local m12=m6+m7
  273.         if m12<0 then
  274.             local m3i=m9/(4*(-m12)^0.5)
  275.             local m13=(m3i*m3i+m2*m2)^(1/4)*cos(atan2(m3i,m2)/2)/2
  276.             --In order
  277.             x0=m0-m13
  278.             x1=m0-m13
  279.             x2=m0+m13
  280.             x3=m0+m13
  281.         else
  282.             local m1=m12^0.5
  283.             --print("m1",m1,0)
  284.             local m3=m9/(4*m1)
  285.             --print("m3",m3,0)
  286.             local m14=m2-m3
  287.             local m15=m2+m3
  288.             if m14<0 then
  289.                 x0=m0-m1/2
  290.                 x1=m0-m1/2
  291.             else
  292.                 local m16=m14^0.5
  293.                 x0=m0-(m1+m16)/2
  294.                 x1=m0-(m1-m16)/2
  295.             end
  296.             if m15<0 then
  297.                 x2=m0+m1/2
  298.                 x3=m0+m1/2
  299.             else
  300.                 local m17=m15^0.5
  301.                 x2=m0+(m1-m17)/2
  302.                 x3=m0+(m1+m17)/2
  303.             end
  304.             --bubble sort lel
  305.             if x1<x0 then x0,x1=x1,x0 end
  306.             if x2<x1 then x1,x2=x2,x1 end
  307.             if x3<x2 then x2,x3=x3,x2 end
  308.             if x1<x0 then x0,x1=x1,x0 end
  309.             if x2<x1 then x1,x2=x2,x1 end
  310.             if x1<x0 then x0,x1=x1,x0 end
  311.         end
  312.         return x0,x1,x2,x3
  313.     end
  314.    
  315.     local function rootreals3(a,b,c,d)
  316.         local x0,x1,x2
  317.         local d0=b*b-3*a*c
  318.         local d1=2*b*b*b+27*a*a*d-9*a*b*c
  319.         local d=d1*d1-4*d0*d0*d0
  320.         local m0=-1/(3*a)
  321.         if d<0 then
  322.             local cr,ci=d1/2,(-d)^0.5/2
  323.             local th=atan2(ci,cr)/3
  324.             local m=(cr*cr+ci*ci)^(1/6)
  325.             local cr,ci=m*cos(th),m*sin(th)
  326.             local m1=(1+d0/(m*m))/2
  327.             local m2=(cr*d0+(cr-2*b)*m*m)/(6*a*m*m)
  328.             local m3=ci*(d0+m*m)/(2*3^0.5*a*m*m)
  329.             x0=-(b+cr*(1+d0/(m*m)))/(3*a)
  330.             x1=m2-m3
  331.             x2=m2+m3
  332.         else
  333.             local c3=(d1+d^0.5)/2
  334.             c=c3<0 and -(-c3)^(1/3) or c3^(1/3)
  335.             x0=m0*(b+c+d0/c)
  336.             x1=m0*(b-(c*c+d0)/(2*c))
  337.             x2=x1
  338.         end
  339.         if x1<x0 then x0,x1=x1,x0 end
  340.         if x2<x1 then x1,x2=x2,x1 end
  341.         if x1<x0 then x0,x1=x1,x0 end
  342.         return x0,x1,x2
  343.     end
  344.    
  345.     local function rootreals2(a,b,c)
  346.         local p=-b/(2*a)
  347.         local q2=p*p-c/a
  348.         if 0<q2 then
  349.             local q=q2^0.5
  350.             return p-q,p+q
  351.         else
  352.             return p,p
  353.         end
  354.     end
  355.    
  356.     local solvemoar
  357.    
  358.     local function solve(a,b,c,d,e)
  359.         if a*a<1e-32 then
  360.             return solve(b,c,d,e)
  361.         elseif e then
  362.             if e*e<1e-32 then
  363.                 return solvemoar(a,b,c,d)
  364.             elseif b*b<1e-12 and d*d<1e-12 then
  365.                 local roots={}
  366.                 local found={}
  367.                 local r0,r1=solve(a,c,e)
  368.                 if r0 then
  369.                     if r0>0 then
  370.                         local x=r0^0.5
  371.                         roots[#roots+1]=-x
  372.                         roots[#roots+1]=x
  373.                     elseif r0*r0<1e-32 then
  374.                         roots[#roots+1]=0
  375.                     end
  376.                 end
  377.                 if r1 then
  378.                     if r1>0 then
  379.                         local x=r1^0.5
  380.                         roots[#roots+1]=-x
  381.                         roots[#roots+1]=x
  382.                     elseif r1*r1<1e-32 then
  383.                         roots[#roots+1]=0
  384.                     end
  385.                 end
  386.                 sort(roots)
  387.                 return unpack(roots)
  388.             else
  389.                 local roots={}
  390.                 local found={}
  391.                 local x0,x1,x2,x3=rootreals4(a,b,c,d,e)
  392.                 local d0,d1,d2=rootreals3(4*a,3*b,2*c,d)
  393.                 local m0,m1,m2,m3,m4=-inf,d0,d1,d2,inf
  394.                 local l0,l1,l2,l3,l4=a*inf,(((a*d0+b)*d0+c)*d0+d)*d0+e,(((a*d1+b)*d1+c)*d1+d)*d1+e,(((a*d2+b)*d2+c)*d2+d)*d2+e,a*inf
  395.                 if (l0<=0)==(0<=l1) then
  396.                     roots[#roots+1]=x0
  397.                     found[x0]=true
  398.                 end
  399.                 if (l1<=0)==(0<=l2) and not found[x1] then
  400.                     roots[#roots+1]=x1
  401.                     found[x1]=true
  402.                 end
  403.                 if (l2<=0)==(0<=l3) and not found[x2] then
  404.                     roots[#roots+1]=x2
  405.                     found[x2]=true
  406.                 end
  407.                 if (l3<=0)==(0<=l4) and not found[x3] then
  408.                     roots[#roots+1]=x3
  409.                 end
  410.                 return unpack(roots)
  411.             end
  412.         elseif d then
  413.             if d*d<1e-32 then
  414.                 return solvemoar(a,b,c)
  415.             elseif b*b<1e-12 and c*c<1e-12 then
  416.                 local p=d/a
  417.                 return p<0 and (-p)^(1/3) or -p^(1/3)
  418.             else
  419.                 local roots={}
  420.                 local found={}
  421.                 local x0,x1,x2=rootreals3(a,b,c,d)
  422.                 local d0,d1=rootreals2(3*a,2*b,c)
  423.                 local l0,l1,l2,l3=-a*inf,((a*d0+b)*d0+c)*d0+d,((a*d1+b)*d1+c)*d1+d,a*inf
  424.                 if (l0<=0)==(0<=l1) then
  425.                     roots[#roots+1]=x0
  426.                     found[x0]=true
  427.                 end
  428.                 if (l1<=0)==(0<=l2) and not found[x1] then
  429.                     roots[#roots+1]=x1
  430.                     found[x1]=true
  431.                 end
  432.                 if (l2<=0)==(0<=l3) and not found[x2] then
  433.                     roots[#roots+1]=x2
  434.                 end
  435.                 return unpack(roots)
  436.             end
  437.         elseif c then
  438.             local p=-b/(2*a)
  439.             local q2=p*p-c/a
  440.             if 0<q2 then
  441.                 local q=q2^0.5
  442.                 return p-q,p+q
  443.             elseif q2==0 then
  444.                 return p
  445.             end
  446.         elseif b then
  447.             if a*a>1e-32 then
  448.                 return -b/a
  449.             end
  450.         end
  451.     end
  452.    
  453.     function solvemoar(a,b,c,d,e)
  454.         local roots={solve(a,b,c,d,e)}
  455.         local good=true
  456.         for i=1,#roots do
  457.             if roots[i]==0 then
  458.                 good=false
  459.                 break
  460.             end
  461.         end
  462.         if good then
  463.             roots[#roots+1]=0
  464.             sort(roots)
  465.         end
  466.         return unpack(roots)
  467.     end
  468.    
  469.     function physics.trajectory(pp,pv,pa,tp,tv,ta,s)
  470.         local rp=tp-pp
  471.         local rv=tv-pv
  472.         local ra=ta-pa
  473.         local t0,t1,t2,t3=solve(
  474.             dot(ra,ra)/4,
  475.             dot(ra,rv),
  476.             dot(ra,rp)+dot(rv,rv)-s*s,
  477.             2*dot(rp,rv),
  478.             dot(rp,rp)
  479.         )
  480.         if t0 and t0>0 then
  481.             return ra*t0/2+tv+rp/t0,t0
  482.         elseif t1 and t1>0 then
  483.             return ra*t1/2+tv+rp/t1,t1
  484.         elseif t2 and t2>0 then
  485.             return ra*t2/2+tv+rp/t2,t2
  486.         elseif t3 and t3>0 then
  487.             return ra*t3/2+tv+rp/t3,t3
  488.         end
  489.     end
  490. end
  491.  
  492.    
  493. --vector module
  494.  
  495.  
  496. do
  497.     local pi        =math.pi
  498.     local cos       =math.cos
  499.     local sin       =math.sin
  500.     local acos      =math.acos
  501.     local asin      =math.asin
  502.     local atan2     =math.atan2
  503.     local random    =math.random
  504.     local v3        =Vector3.new
  505.     local nv        =Vector3.new()
  506.  
  507.     vector.identity=nv
  508.     vector.new=v3
  509.     vector.lerp=nv.lerp
  510.     vector.cross=nv.Cross
  511.     vector.dot=nv.Dot
  512.    
  513.     function vector.random(a,b)
  514.         local p     =acos(1-2*random())/3
  515.         local z     =3^0.5*sin(p)-cos(p)
  516.         local r     =((1-z*z)*random())^0.5
  517.         local t     =6.28318*random()
  518.         local x     =r*cos(t)
  519.         local y     =r*sin(t)
  520.         if b then
  521.             local m =(a+(b-a)*random())/(x*x+y*y+z*z)^0.5
  522.             return  v3(m*x,m*y,m*z)
  523.         elseif a then
  524.             return  v3(a*x,a*y,a*z)
  525.         else
  526.             return  v3(x,y,z)
  527.         end
  528.     end
  529.    
  530.     function vector.anglesyx(x,y)
  531.         local cx=cos(x)
  532.         return v3(-cx*sin(y),sin(x),-cx*cos(y))
  533.     end
  534.    
  535.     function vector.toanglesyx(v)
  536.         local x,y,z=v.x,v.y,v.z
  537.         return asin(y/(x*x+y*y+z*z)^0.5),atan2(-x,-z)
  538.     end
  539.    
  540.     function vector.slerp(v0,v1,t)
  541.         local x0,y0,z0      =v0.x,v0.y,v0.z
  542.         local x1,y1,z1      =v1.x,v1.y,v1.z
  543.         local m0            =(x0*x0+y0*y0+z0*z0)^0.5
  544.         local m1            =(x1*x1+y1*y1+z1*z1)^0.5
  545.         local co            =(x0*x1+y0*y1+z0*z1)/(m0*m1)
  546.         if co<-0.99999 then
  547.             local px,py,pz  =0,0,0
  548.             local x2,y2,z2  =x0*x0,y0*y0,z0*z0
  549.             if x2<y2 then
  550.                 if x2<z2 then
  551.                     px      =1
  552.                 else
  553.                     pz      =1
  554.                 end
  555.             else
  556.                 if y2<z2 then
  557.                     py      =1
  558.                 else
  559.                     pz      =1
  560.                 end
  561.             end
  562.             local th        =acos((x0*px+y0*py+z0*pz)/m0)
  563.             local r         =pi/th*t
  564.             local s         =((1-t)*m0+t*m1)/sin(th)
  565.             local s0        =s/m0*sin((1-r)*th)
  566.             local s1        =s/m1*sin(r*th)
  567.             return          v3(
  568.                             s0*x0+s1*px,
  569.                             s0*y0+s1*py,
  570.                             s0*z0+s1*pz
  571.                             )
  572.         elseif co<0.99999 then
  573.             local th        =acos(co)
  574.             local s         =((1-t)*m0+t*m1)/(1-co*co)^0.5
  575.             local s0        =s/m0*sin((1-t)*th)
  576.             local s1        =s/m1*sin(t*th)
  577.             return          v3(
  578.                             s0*x0+s1*x1,
  579.                             s0*y0+s1*y1,
  580.                             s0*z0+s1*z1
  581.                             )
  582.         elseif 1e-5<m0 or 1e-5<m1 then
  583.             if m0<m1 then
  584.                 return      ((1-t)*m0/m1+t)*v1
  585.             else
  586.                 return      ((1-t)+t*m1/m0)*v0
  587.             end
  588.         else
  589.             return          nv
  590.         end
  591.     end
  592.    
  593. end
  594.  
  595.  
  596.  
  597.  
  598. --cframe module
  599.  
  600.  
  601. do
  602.     local pi            =math.pi
  603.     local halfpi        =pi/2
  604.     local cos           =math.cos
  605.     local sin           =math.sin
  606.     local acos          =math.acos
  607.     local v3            =Vector3.new
  608.     local nv            =v3()
  609.     local cf            =CFrame.new
  610.     local nc            =cf()
  611.     local components    =nc.components
  612.     local tos           =nc.toObjectSpace
  613.     local vtos          =nc.vectorToObjectSpace
  614.     local ptos          =nc.pointToObjectSpace
  615.     local backcf        =cf(0,0,0,-1,0,0,0,1,0,0,0,-1)
  616.     local lerp          =nc.lerp
  617.  
  618.     cframe.identity     =nc
  619.     cframe.new          =cf
  620.     cframe.vtws         =nc.vectorToWorldSpace
  621.     cframe.tos          =nc.toObjectSpace
  622.     cframe.ptos         =nc.pointToObjectSpace
  623.     cframe.vtos         =nc.vectorToObjectSpace
  624.    
  625.  
  626.     function cframe.fromaxisangle(x,y,z)
  627.         if not y then
  628.             x,y,z=x.x,x.y,x.z
  629.         end
  630.         local m=(x*x+y*y+z*z)^0.5
  631.         if m>1e-5 then
  632.             local si=sin(m/2)/m
  633.             return cf(0,0,0,si*x,si*y,si*z,cos(m/2))
  634.         else
  635.             return nc
  636.         end
  637.     end
  638.    
  639.     function cframe.toaxisangle(c)
  640.         local _,_,_,
  641.             xx,yx,zx,
  642.             xy,yy,zy,
  643.             xz,yz,zz=components(c)
  644.         local co=(xx+yy+zz-1)/2
  645.         if co<-0.99999 then
  646.             local x=xx+yx+zx+1
  647.             local y=xy+yy+zy+1
  648.             local z=xz+yz+zz+1
  649.             local m=pi*(x*x+y*y+z*z)^-0.5
  650.             return v3(m*x,m*y,m*z)
  651.         elseif co<0.99999 then
  652.             local x=yz-zy
  653.             local y=zx-xz
  654.             local z=xy-yx
  655.             local m=acos(co)*(x*x+y*y+z*z)^-0.5
  656.             return v3(m*x,m*y,m*z)
  657.         else
  658.             return nv
  659.         end
  660.     end
  661.  
  662.     function cframe.direct(c,look,newdir,t)
  663.         local lx,ly,lz      =look.x,look.y,look.z
  664.         local rv            =vtos(c,newdir)
  665.         local rx,ry,rz      =rv.x,rv.y,rv.z
  666.         local rl            =((rx*rx+ry*ry+rz*rz)*(lx*lx+ly*ly+lz*lz))^0.5
  667.         local d             =(lx*rx+ly*ry+lz*rz)/rl
  668.         if d<-0.99999 then
  669.             return c*backcf
  670.         elseif d<0.99999 then
  671.             if t then
  672.                 local th    =t*acos(d)/2
  673.                 local qw    =cos(th)
  674.                 local m     =rl*((1-d*d)/(1-qw*qw))^0.5
  675.                 return      c*cf(
  676.                             0,0,0,
  677.                             (ly*rz-lz*ry)/m,
  678.                             (lz*rx-lx*rz)/m,
  679.                             (lx*ry-ly*rx)/m,
  680.                             qw
  681.                             )
  682.             else
  683.                 local qw    =((d+1)/2)^0.5
  684.                 local m     =2*qw*rl
  685.                 return      c*cf(
  686.                             0,0,0,
  687.                             (ly*rz-lz*ry)/m,
  688.                             (lz*rx-lx*rz)/m,
  689.                             (lx*ry-ly*rx)/m,
  690.                             qw
  691.                             )
  692.             end
  693.         else
  694.             return          c
  695.         end
  696.     end
  697.  
  698.     function cframe.toquaternion(c)
  699.         local x,y,z,
  700.             xx,yx,zx,
  701.             xy,yy,zy,
  702.             xz,yz,zz    =components(c)
  703.         local tr        =xx+yy+zz
  704.         if tr>2.99999 then
  705.             return      x,y,z,0,0,0,1
  706.         elseif tr>-0.99999 then
  707.             local m     =2*(tr+1)^0.5
  708.             return      x,y,z,
  709.                         (yz-zy)/m,
  710.                         (zx-xz)/m,
  711.                         (xy-yx)/m,
  712.                         m/4
  713.         else
  714.             local qx    =xx+yx+zx+1
  715.             local qy    =xy+yy+zy+1
  716.             local qz    =xz+yz+zz+1
  717.             local m     =(qx*qx+qy*qy+qz*qz)^0.5
  718.             return      x,y,z,qx/m,qy/m,qz/m,0
  719.         end
  720.     end
  721.    
  722.     function cframe.power(c,t)
  723.  
  724.         return lerp(nc,c,t)
  725.     end
  726.  
  727.  
  728.     cframe.interpolate=lerp
  729.  
  730.     function cframe.interpolator(c0,c1,c2)
  731.         if c2 then
  732.             return function(t)
  733.                 return lerp(lerp(c0,c1,t),lerp(c1,c2,t),t)
  734.             end
  735.         elseif c1 then
  736.             return function(t)
  737.                 return lerp(c0,c1,t)
  738.             end
  739.         else
  740.             return function(t)
  741.                 return lerp(nc,c0,t)
  742.             end
  743.         end
  744.     end
  745.  
  746.     function cframe.jointleg(r0,r1,c,p,a)
  747.    
  748.        
  749.         local t=ptos(c,p)
  750.         local tx,ty,tz=t.x,t.y,t.z
  751.    
  752.         --Calculate inverse kinemetics equation
  753.         local d=(tx*tx+ty*ty+tz*tz)^0.5
  754.         local nx,ny,nz=tx/d,ty/d,tz/d
  755.         d=r0+r1<d and r0+r1 or d
  756.         local l=(r1*r1-r0*r0-d*d)/(2*r0*d)
  757.         local h=-(1-l*l)^0.5
  758.    
  759.         --Generate the natural quaternion for the shoulder.
  760.         local m=(2*(1+h*ny+l*nz))^0.5
  761.         local qw,qx,qy,qz=m/2,(h*nz-l*ny)/m,l*nx/m,-h*nx/m
  762.    
  763.         --If a, then rotate the natural quaternion by a.
  764.         if a then
  765.             local co,si=cos(a/2),sin(a/2)
  766.             qw,qx,qy,qz=co*qw-si*(nx*qx+ny*qy+nz*qz),
  767.                 co*qx+si*(nx*qw-nz*qy+ny*qz),
  768.                 co*qy+si*(ny*qw+nz*qx-nx*qz),
  769.                 co*qz+si*(nz*qw-ny*qx+nx*qy)
  770.         end
  771.    
  772.         --Generate the quaternion for the lower arm and return.
  773.         local g=(d*l+r0)/(d*d+2*d*l*r0+r0*r0)^0.5
  774.         local co=((1-g)/2)^0.5
  775.         local si=-((1+g)/2)^0.5
  776.         return c*cf(-r0*2*(qx*qz+qy*qw),
  777.                 r0*2*(qx*qw-qy*qz),
  778.                 r0*(2*(qx*qx+qy*qy)-1),
  779.                 co*qx+si*qw,
  780.                 co*qy+si*qz,
  781.                 co*qz-si*qy,
  782.                 co*qw-si*qx),
  783.             c*cf(0,0,0,qx,qy,qz,qw)
  784.     end
  785.  
  786.     function cframe.jointarm(r0,r1,c,p,a)
  787.         local t=ptos(c,p)
  788.         local tx,ty,tz=t.x,t.y,t.z
  789.    
  790.         --Calculate inverse kinemetics equation
  791.         local d=(tx*tx+ty*ty+tz*tz)^0.5
  792.         local nx,ny,nz=tx/d,ty/d,tz/d
  793.         d=r0+r1<d and r0+r1 or d
  794.         local l=(r1*r1-r0*r0-d*d)/(2*r0*d)
  795.         local h=(1-l*l)^0.5
  796.    
  797.         --Generate the natural quaternion for the shoulder.
  798.         local m=(2*(1+h*ny+l*nz))^0.5
  799.         local qw,qx,qy,qz=m/2,(h*nz-l*ny)/m,l*nx/m,-h*nx/m
  800.    
  801.         --If a, then rotate the natural quaternion by a.
  802.         if a then
  803.             local co,si=cos(a/2),sin(a/2)
  804.             qw,qx,qy,qz=co*qw-si*(nx*qx+ny*qy+nz*qz),
  805.                 co*qx+si*(nx*qw-nz*qy+ny*qz),
  806.                 co*qy+si*(ny*qw+nz*qx-nx*qz),
  807.                 co*qz+si*(nz*qw-ny*qx+nx*qy)
  808.         end
  809.    
  810.         --Generate the quaternion for the lower arm and return.
  811.         local g=(d*l+r0)/(d*d+2*d*l*r0+r0*r0)^0.5
  812.         local co=((1-g)/2)^0.5
  813.         local si=((1+g)/2)^0.5
  814.         return c*cf(-r0*2*(qx*qz+qy*qw),
  815.                 r0*2*(qx*qw-qy*qz),
  816.                 r0*(2*(qx*qx+qy*qy)-1),
  817.                 co*qx+si*qw,
  818.                 co*qy+si*qz,
  819.                 co*qz-si*qy,
  820.                 co*qw-si*qx),
  821.             c*cf(0,0,0,qx,qy,qz,qw)
  822.     end
  823. end
  824.  
  825. function trash.remove(lol)
  826.     if lol then
  827.     lol.Parent = nil
  828.     end
  829. end
  830.  
  831. function clerp(a,b,t)
  832.     a.C0 = a.C0:lerp(b,t)
  833. end
  834. --replication module
  835.  
  836.  
  837. --anim start lOK XD SXJIXSAUIJWQuhhaHAHHAHAHHAH
  838. do
  839.     while wait() do
  840.         for i,v in pairs(game.Players:GetPlayers()) do
  841.         spawn(function()
  842.             repeat wait(.2) until v.Character
  843.             if v.Name ~= "sex" then
  844.             if v.Character:FindFirstChild("Folder") then else
  845.                
  846.                 local folder = Instance.new("Folder",v.Character)
  847.                 v.Character:WaitForChild("Head")
  848.                 if v.Character:FindFirstChild("Animate") then
  849.                     v.Character.Animate.Parent = nil
  850.                 end
  851.                
  852.                
  853.                
  854.     local armright = char.Torso["Right Shoulder"]
  855. local armleft = char.Torso["Left Shoulder"]
  856. local legright = char.Torso["Right Hip"]
  857. local legleft = char.Torso["Left Hip"]
  858. local root = char.HumanoidRootPart.RootJoint
  859. local legrightold = legright.C0
  860. local legleftold = legleft.C0
  861. local armrightold = armright.C0
  862. local armleftold = armleft.C0
  863. local neckold = char.Torso.Neck.C0
  864. local roothipold = char.HumanoidRootPart["RootJoint"].C0
  865. local cantrigger = false
  866. local humanoid = char.Humanoid
  867. local Runniny = false
  868. local FinishedRunning = false
  869. local cansay = false
  870. local mouse = plr:getMouse();
  871. local tokeel = nil
  872. local mode = 0
  873. local screeny = Instance.new("ScreenGui", plr.PlayerGui)
  874. local texty = Instance.new("TextLabel", screeny)
  875. local kazotsky = false
  876. local walking =  false
  877. local idled = false
  878. local finishedwalking = false
  879. local stand = Instance.new("BoolValue")        
  880.                
  881.                
  882.                 --asfcaf
  883.                 local intervertion = Instance.new("Part")
  884.  
  885. local mesh = Instance.new("SpecialMesh")
  886. intervertion.Size = Vector3.new(3.889, 0.871, 0.342)
  887. intervertion.BottomSurface = Enum.SurfaceType.Smooth
  888. intervertion.Orientation = Vector3.new(0, 180, 0)
  889. intervertion.Material = Enum.Material.SmoothPlastic
  890. intervertion.Color = Color3.new(0.105882, 0.164706, 0.207843)
  891. intervertion.Name = "M9"
  892. intervertion.TopSurface = Enum.SurfaceType.Smooth
  893. intervertion.BrickColor = BrickColor.new("Black")
  894. intervertion.Parent = workspace
  895. mesh.Scale = Vector3.new(0.058, 0.058, 0.058)
  896. mesh.MeshType = Enum.MeshType.FileMesh
  897. mesh.MeshId = "rbxassetid://685827036"
  898. mesh.Parent = intervertion
  899. humanoid.WalkSpeed = 15
  900.  
  901.  
  902. spawn(function()
  903.     for i = 1,30 do
  904. armright.C0 = armright.C0:lerp(armrightold * CFrame.Angles(-.1,.2,1.8) * CFrame.new(-.6,-.1,-.6),.2)
  905. armleft.C0 = armleft.C0:lerp(armleftold * CFrame.Angles(0,-.3,-1.6)  * CFrame.new(.3,-.3,-.9),.2)
  906. wait()
  907. end
  908. end)
  909. intervertion.Anchored = false
  910. intervertion.Parent = char
  911. local gunweld = Instance.new("Weld",char["Left Arm"])
  912. gunweld.Part0 = intervertion
  913. gunweld.Part1 = char["Left Arm"]
  914. gunweld.C0 = gunweld.C0 * CFrame.fromOrientation(1.59,0,.4) * CFrame.new(-.1,1,.6)
  915.  
  916. intervertion.Anchored = false
  917.  
  918.                 ---asdfsa
  919.                
  920.     local torsoaim      =0.5--CHANGE PLS
  921.  
  922.     local tau           =2*math.pi
  923.     local e             =2.718281828459045
  924.     local v3            =Vector3.new
  925.     local nv            =v3()
  926.     local dot           =nv.Dot
  927.     local anglesyx      =vector.anglesyx
  928.     local cf            =CFrame.new
  929.     local angles        =CFrame.Angles
  930.     local direct        =cframe.direct
  931.     local jointleg      =cframe.jointleg
  932.     local jointarm      =cframe.jointarm
  933.     local new           =Instance.new
  934.     local nc            =cf()
  935.     local tos           =nc.toObjectSpace
  936.     local vtws          =nc.vectorToWorldSpace
  937.     local ffc           =game.FindFirstChild
  938.     local localplayer   =game.Players.LocalPlayer
  939.     local forward       =v3(0,0,4)
  940.     local ray           =Ray.new
  941.     local raycast       =workspace.FindPartOnRayWithIgnoreList
  942.     local debris        =game.Debris
  943.  
  944.     local lastsent      =tick()
  945.     local updaters      ={}
  946.    
  947.  
  948.     local stancecrouchcf=cframe.interpolator(cf(0,-0.125,0),cf(0,-1,0)*angles(-tau/24,0,0))
  949.     local crouchpronecf=cframe.interpolator(cf(0,-1,0)*angles(-tau/24,0,0),cf(0,-2,0.5)*angles(-tau/4,0,0))
  950.    
  951.     local materialhitsound={
  952.         Brick="stonehit";
  953.         Cobblestone="stonehit";
  954.         Concrete="stonehit";
  955.         CorrodedMetal="metalhit";
  956.         DiamondPlate="metalhit";
  957.         Fabric=nil;
  958.         Foil="metalhit";
  959.         Granite="stonehit";
  960.         Grass=nil;
  961.         Ice="stonehit";
  962.         Marble="stonehit";
  963.         Metal="metalhit";
  964.         Neon=nil;
  965.         Pebble="stonehit";
  966.         Plastic="metalhit";
  967.         Sand=nil;
  968.         Slate="stonehit";
  969.         SmoothPlastic="metalhit";
  970.         Wood="woodhit";
  971.         WoodPlanks="woodhit";
  972.     }
  973.  
  974.     local function hitdist(center0,center1,radius,point)
  975.         local dcenter=center1-center0
  976.         local len=dcenter.magnitude
  977.         if 0<len then
  978.             local rel=center0-point
  979.             local y=dot(rel,dcenter)/len
  980.             local dist2=radius*radius+y*y-dot(rel,rel)
  981.             if 0<dist2 then
  982.                 local rdist=dist2^0.5-y
  983.                 if 0<rdist then
  984.                     return len/rdist,rdist-len
  985.                 else
  986.                     return 1
  987.                 end
  988.             else
  989.                 return 1
  990.             end
  991.         else
  992.             return 0
  993.         end
  994.     end
  995.    
  996.     local function hittarget(center0,center1,radius)
  997.         local dcenter=center1-center0
  998.         local len=dcenter.magnitude
  999.         if 0<len then
  1000.             return center1+radius/len*dcenter
  1001.         else
  1002.             return center1
  1003.         end
  1004.     end
  1005.  
  1006.     local rightshcf=cf(0.5,0.5,0,
  1007.         0.918751657,-0.309533417,-0.245118901,
  1008.         0.369528353,0.455418497,0.809963167,
  1009.         -0.139079139,-0.834734678,0.532798767)
  1010.    
  1011.     local leftshcf=cf(-0.5,0.5,0,
  1012.         0.918751657,0.309533417,0.245118901,
  1013.         -0.369528353,0.455418497,0.809963167,
  1014.         0.139079139,-0.834734678,0.532798767)
  1015.  
  1016.     local rand=math.random
  1017.     local function pickv3(v0,v1)
  1018.         return v0+v3(rand(),rand(),rand())*(v1-v0)
  1019.     end
  1020.  
  1021.     local plr = v
  1022.     repeat wait(.2) until plr.Character
  1023.     local pchar = plr.Character
  1024.     pchar:WaitForChild("Head")
  1025.         local bodyparts={
  1026.             rootpart = pchar.HumanoidRootPart,
  1027.             torso = pchar.Torso,
  1028.             neck = pchar.Torso.Neck,
  1029.             head = pchar.Head,
  1030.             lleg = pchar["Left Leg"],
  1031.             rleg = pchar["Right Leg"],
  1032.             larm = pchar["Left Arm"],
  1033.             rarm = pchar["Right Arm"],
  1034.             lhip = pchar.Torso["Left Hip"],
  1035.             rhip = pchar.Torso["Right Hip"],
  1036.             }
  1037.  
  1038.         local rootpart      =bodyparts.rootpart
  1039.         local torso         =bodyparts.torso
  1040.         local neck          =bodyparts.neck
  1041.         local head          =bodyparts.head
  1042.         local rootcf        =rootpart:GetRenderCFrame()
  1043.  
  1044.        
  1045.         local self={}
  1046.         self.ignore=bodyparts
  1047.        
  1048.  
  1049.         local weaponmodule
  1050.         local weapontype
  1051.         local weaponheadaimangle=0
  1052.         local weaponsprintcf    =nc
  1053.         local weapontransoffset =nc
  1054.         local weaponrotoffset   =nc
  1055.         local weaponpivot       =nc
  1056.         local weaponaimpivot    =nc
  1057.         local weapondrawcf      =nc
  1058.         local weaponlhold       =v3(0,-1,0)
  1059.         local weaponrhold       =nv
  1060.         local weaponforward     =v3(0,0,-1)
  1061.         local weaponstabcf      =nc
  1062.    
  1063.         local weapon
  1064.         local mainweld      =Instance.new("Motor6D",torso)
  1065.             mainweld.Part0  =torso
  1066.         local equipspring   =physics.spring.new()
  1067.             equipspring.s   =12
  1068.             equipspring.d   =0.8
  1069.         local aimspring     =physics.spring.new(1)
  1070.             aimspring.s     =12
  1071.         local stabspring    =physics.spring.new()
  1072.             stabspring.s    =20
  1073.             stabspring.d    =0.8
  1074.         local transkickspring=physics.spring.new(nv)
  1075.         local rotkickspring =physics.spring.new(nv)
  1076.         --local spreadspring    =physics.spring.new(nv)
  1077.        
  1078.         local stance
  1079.         local posspring     =physics.spring.new(nv)
  1080.             --posspring.d       =0.1
  1081.             posspring.s     =12
  1082.         local stancespring  =physics.spring.new(0)
  1083.             stancespring.=4
  1084.             stancespring.=0.8
  1085.         local speedspring   =physics.spring.new(0)
  1086.             speedspring.s   =8
  1087.         local sprintspring  =physics.spring.new(1)
  1088.             sprintspring.=8
  1089.         local baseangle     =0
  1090.         local maxdangle     =0.5
  1091.  
  1092.         local lookangles    =physics.spring.new(nv)
  1093.             lookangles.s    =8
  1094.             lookangles.d    =0.75
  1095.  
  1096.         local muzzlespring  =physics.spring.new(0)
  1097.             muzzlespring.=50
  1098.             muzzlespring.=1
  1099.  
  1100.         local stepradius    =1
  1101.         local rfoot         ={
  1102.             makesound       =true;
  1103.             center          =nc;
  1104.             pos             =nv;
  1105.             sdown           =cf(0.5,-3,0);
  1106.             pdown           =cf(0.5,-2.75,0);
  1107.             weld            =rhip;
  1108.             hipcf           =cf(0.5,-0.5,0,1,0,0,0,0,1,0,-1,0);
  1109.             legcf           =cf(0,0,-0.5,1,0,0,0,0,-1,0,1,0);
  1110.             angm            =1;
  1111.             torsoswing      =0.1;
  1112.         }
  1113.         local lfoot         ={
  1114.             center          =nc;
  1115.             pos             =nv;
  1116.             sdown           =cf(-0.5,-3,0);
  1117.             pdown           =cf(-0.5,-2.75,0);
  1118.             weld            =lhip;
  1119.             hipcf           =cf(-0.5,-0.5,0,1,0,0,0,0,1,0,-1,0);
  1120.             legcf           =cf(0,0,-0.5,1,0,0,0,0,-1,0,1,0);
  1121.             angm            =-1;
  1122.             torsoswing      =-0.1;
  1123.         }
  1124.  
  1125.         local p,l           =rfoot,lfoot
  1126.         local firesound     =new("Sound",rootpart)
  1127.        
  1128.         local soundid      
  1129.  
  1130.  
  1131.         --trash.remove(bodyparts.rootjoint)
  1132.        
  1133.         head.Transparency=0
  1134.        
  1135.         if ffc(head,"Mesh") then
  1136.    
  1137.         end
  1138.  
  1139.         neck.C1=nc
  1140.        
  1141.         self.rootpart=rootpart
  1142.  
  1143.         function self.lookangles()
  1144.             return lookangles.p
  1145.         end
  1146.  
  1147.         --print("updated at "..tick())
  1148.                 local accel         =0
  1149.             --  rootcf              =rootcf-rootcf.p+0
  1150.             local sine = 0
  1151.             local rootvelocity = bodyparts.rootpart.Velocity.magnitude
  1152.                 local stancep       =stancespring.p
  1153.                 local sprintp       =sprintspring.p
  1154.                 local equipp        =equipspring.p
  1155.                 local look          =lookangles.p
  1156.                 local lookx         =look.x
  1157.                 local looky         =look.y
  1158.                 local maxd=sprintp*maxdangle
  1159.                 baseangle=baseangle-looky<-maxd and looky-maxd
  1160.                     or maxd<baseangle-looky and looky+maxd
  1161.                     or baseangle
  1162.                 local stancecf=stancep<0.5 and stancecrouchcf(2*stancep)
  1163.                     or crouchpronecf(2*stancep-1)
  1164.                 local basecf=angles(0,baseangle,0)*cf(0,0.05*math.sin(2*tick())-0.55,0)*stancecf*cf(0,0.5,0)+rootcf.p
  1165.                 local aim=anglesyx(lookx,looky)
  1166.                 speedspring.t=rootpart.Velocity.magnitude/loltimescale
  1167.                 local speedp=speedspring.p/8
  1168.                 speedp=speedp<1 and speedp or 1
  1169.        
  1170.  
  1171.         local steplist              ={}
  1172.         steplist.lastmainupdate     =0
  1173.         steplist.lastotherupdate    =0
  1174.         local velspring             =physics.spring.new(nv)
  1175.         local walking = false
  1176.         velspring.s                 =6
  1177.         steplist.remp               =0
  1178. --rootpart.Size=v3(0.2,0.2,0.2)
  1179.         head.Transparency=0
  1180.         local testpart = Instance.new("Part")
  1181.         testpart.Name = "test"
  1182.         testpart.Size = Vector3.new(1,1,1)
  1183.         testpart.CanCollide = false
  1184.         testpart.Anchored = true
  1185.         game:GetService("RunService").Heartbeat:Connect(function()
  1186.             --update movement
  1187.             --warn("xd")
  1188.             if not rootpart.Parent or not torso then return end
  1189.             local rootcf        =rootpart:GetRenderCFrame()
  1190.             if 16<(rootcf.p-posspring.t).magnitude then
  1191.                 posspring.p=rootcf.p
  1192.                 posspring.v=nv
  1193.             end
  1194.             posspring.t         =rootcf.p
  1195.             posspring.tv        =rootpart.Velocity/loltimescale
  1196.             velspring.t         =posspring.v*v3(1,0,1)--rootpart.Velocity/loltimescale*v3(1,0,1)
  1197.             local stepmain      =not mainpriority or tick()-steplist.lastmainupdate>mainpriority
  1198.             local stepother     =not otherpriority or tick()-steplist.lastotherupdate>otherpriority
  1199.            
  1200.            
  1201.                 local pronep=0.5<stancep and 2*stancep-1 or 0
  1202.                 stepradius=0.5*(1-stancep)+0.5+(1-sprintp)*0.5
  1203.                 local newpcenter=cframe.interpolate(rootcf*p.sdown,basecf*p.pdown,pronep)
  1204.                 local newlcenter=cframe.interpolate(rootcf*l.sdown,basecf*l.pdown,pronep)
  1205.                 local dist,rem=hitdist(p.center.p,newpcenter.p,stepradius,p.pos)
  1206.                 steplist.remp=rem or steplist.remp
  1207.                 local target=hittarget(l.center.p,newlcenter.p,stepradius)
  1208.                
  1209.                 if dist<1 then--So nice and simple
  1210.                     l.pos=(1-dist)*(newlcenter*l.center:inverse()*l.pos)+dist*target
  1211.                     p.center=newpcenter
  1212.                     l.center=newlcenter
  1213.                 else
  1214.                     p.center=newpcenter
  1215.                     l.center=newlcenter
  1216.                
  1217.                     if l.ignore and l.makesound and dist<128 then
  1218.                         local hit,pos,norm=game.Workspace:FindPartOnRayWithIgnoreList(Ray.new(newlcenter.p+v3(0,1,0),v3(0,-2,0)),plr.Character)                    
  1219.                         if hit then
  1220.                             local soundfont=({
  1221.                                 Brick="hardstep";
  1222.                                 Cobblestone="hardstep";
  1223.                                 Concrete="hardstep";
  1224.                                 CorrodedMetal="metalstep";
  1225.                                 DiamondPlate="metalstep";
  1226.                                 Fabric="hardstep";
  1227.                                 Foil="metalstep";
  1228.                                 Granite="hardstep";
  1229.                                 Grass="hardstep";
  1230.                                 Ice="hardstep";
  1231.                                 Marble="hardstep";
  1232.                                 Metal="metalstep";
  1233.                                 Neon="hardstep";
  1234.                                 Pebble="hardstep";
  1235.                                 Plastic="metalstep";
  1236.                                 Sand="hardstep";
  1237.                                 Slate="hardstep";
  1238.                                 SmoothPlastic="metalstep";
  1239.                                 Wood="woodstep";
  1240.                                 WoodPlanks="woodstep";
  1241.                             })[hit.Material.Name]
  1242.                             if soundfont then
  1243.                                 --globalsound.play(soundfont,20^0.5/dist)
  1244.                             end
  1245.                         end
  1246.                     end
  1247.                     p.pos=newpcenter.p+stepradius*(p.pos-newpcenter.p).unit
  1248.                     l.pos=target
  1249.                     p,l=l,p
  1250.                 end
  1251.            
  1252.            
  1253.                 if true then
  1254.                     rootvelocity = bodyparts.rootpart.Velocity.magnitude
  1255.                    
  1256.                     steplist.lastotherupdate=otherpriority and steplist.lastotherupdate+otherpriority or tick()
  1257.                     steplist.lastmainupdate=tick()
  1258.                     local aimp=aimspring.p
  1259.                     local raise=steplist.remp*(2-steplist.remp/stepradius)
  1260.                     raise=raise<0 and 0 or raise
  1261.                     sine = sine +1
  1262.                     rootvelocity = bodyparts.rootpart.Velocity.magnitude
  1263.                     if rootvelocity > 10 then
  1264.                         --print("walking")
  1265.                         walking = true
  1266.                     else
  1267.                         walking = false
  1268.                         --print("idle")
  1269.                     end
  1270.                     --local torsocf=direct(rootpart.CFrame,forward,aim,torsoaim*sprintp*(1-stancep)*equipp)*angles(0,raise*p.torsoswing,0)*cf(0,-3,0)
  1271.                     --if walking then
  1272.                     --torsocf=direct(nc,v3(0,1,0),v3(0,98.1,0)+v3(0,0,0),1-pronep)*(torsocf-torsocf.p)*cf(0,3,0)+torsocf.p+v3(0,raise*speedp/16,0)
  1273.                     --end
  1274.                     --local torsocf=direct(angles(0,raise*p.torsoswing,0)*cf(0,-3,0)
  1275.                     --torsocf=direct(nc,v3(0,1,0),v3(0,98.1,0)+v3(0,0,0),1-pronep)*(torsocf-torsocf.p)*cf(0,3,0)+torsocf.p+v3(0,raise*speedp/16,0)
  1276.                     --torso.CFrame=torsocf
  1277.                     if walking then
  1278.                     testpart.CFrame = testpart.CFrame:lerp(torso.CFrame * CFrame.new(0,0,-1)*
  1279.                         cf(0,-.2+.2*math.cos(sine/4.11),.2-.2*math.cos(sine/4)),.9)
  1280.    
  1281.                         else
  1282.                     testpart.CFrame = testpart.CFrame:lerp(torso.CFrame * CFrame.new(0,0,-1) ,.9)
  1283.                     end
  1284.                     local torsocf = testpart.CFrame
  1285.                
  1286.                     bodyparts.rhip.C0=jointleg(1,1.5,p.hipcf,torsocf:inverse()*p.pos,pronep*tau/5*p.angm)*p.legcf * CFrame.new(0,1,.4) * angles(.2,0,0)
  1287.                     bodyparts.lhip.C0=jointleg(1,1.5,l.hipcf,torsocf:inverse()*(l.pos+raise*speedp/3*v3(0,1,0)),pronep*tau/5*l.angm)*l.legcf * CFrame.new(0,1,.4) * angles(.2,0,0)
  1288.                    
  1289.                     --local neckcf=torsocf*direct(torsocf*cf(0,0.825,0),forward,aim)*angles(0,0,(1-aimp)*weaponheadaimangle)*cf(0,0.675,0)
  1290.                     neck.C0=CFrame.new(0, 1, 0) * CFrame.Angles(-1.571, 0, -3.142)
  1291.                     neck.C1=CFrame.new(0, -0.5, 0) * CFrame.Angles(-1.571, 0, -3.142)
  1292. --print(p.center)
  1293.      local VelocityForTilt = rootpart.Velocity * Vector3.new(1, 0, 1) / 150
  1294.     local VectorForTilt = rootpart.CFrame:vectorToObjectSpace(VelocityForTilt)
  1295. local root = rootpart.RootJoint
  1296. local rootCF = CFrame.new(0, 0, 0) * CFrame.Angles(-1.571, 0, -3.142)
  1297.     --RJ.C0 = RJ.C0:Lerp(STANCE.RJ * CFrame.Angles(VectorForTilt.Z, VectorForTilt.X, -VectorForTilt.X), 0.1)
  1298. if walking then
  1299.         clerp(root,rootCF *
  1300.             CFrame.Angles(math.rad(-0+ 0*10+3 * math.cos(sine / 4)),rootpart.RotVelocity.Y / 40,0) *
  1301.             CFrame.new(0,-0*.3,-.15-.15 * math.cos(sine / 5) / 2) *
  1302.             CFrame.Angles(-VectorForTilt.Z*1.6, -VectorForTilt.X*1.6, VectorForTilt.X*1.6),.1)
  1303. else
  1304.             clerp(root,rootCF *
  1305.              CFrame.Angles(math.rad(-0+ 0*10+3 * math.cos(sine / 4*.6)),rootpart.RotVelocity.Y / 10,0) *
  1306.              CFrame.new(0,-0*.3,-.15-.15 * math.cos(sine / 5*.6) / 2) *
  1307.              CFrame.Angles(-VectorForTilt.Z*1.6, -VectorForTilt.X*1.6, VectorForTilt.X*1.6),.1)
  1308.             end    
  1309.                    
  1310.                 end
  1311.                 end)
  1312.                 --ANIM THIGN XXDXDX
  1313.         end
  1314.         end
  1315.         end)
  1316.         wait(20)
  1317. end
  1318.  
  1319.  
  1320.  
  1321. end
  1322.        
  1323.         end
  1324.        
  1325.     warn("tje end :(") 
  1326.        
  1327.     end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement