Advertisement
Code_X

Roblox Script Rolling Light Ball

Oct 9th, 2019
1,493
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.42 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2. local chr = plr.Character
  3. local maus = plr:GetMouse()
  4. local PGui=plr.PlayerGui
  5. local lleg = chr["Left Leg"]
  6. local rleg = chr["Right Leg"]
  7. local larm = chr["Left Arm"]
  8. local rarm = chr["Right Arm"]
  9. local hed = chr.Head
  10. local rutprt = chr.HumanoidRootPart
  11. local torso = chr.Torso
  12. local otheranims=false
  13. local armmovement=false
  14. chr.Animate.Disabled=true
  15. local RunSpeed=36
  16. local WlkSpeed=18
  17. local runnin=false
  18. local tik=0
  19. local rollvalue=0
  20. local swimming=false
  21. local fldb={['w']=false,['a']=false,['s']=false,['d']=false}
  22. local jumpval=0
  23. local idlerollv=0
  24.  
  25. local BallColor=torso.BrickColor
  26. local BallTransparency=0
  27. local BallReflectance=0
  28. local BallMaterial="Neon"
  29.  
  30.  
  31.  
  32. coroutine.wrap(function()
  33. for i,x in pairs(hed:GetChildren()) do if x:IsA('Sound') then x:Destroy() end end end)()
  34. function Lerp(a, b, i)
  35. local com1 = {a.X, a.Y, a.Z, a:toEulerAnglesXYZ()}
  36. local com2 = {b.X, b.Y, b.Z, b:toEulerAnglesXYZ()}
  37. local calx = com1[1] + (com2[1] - com1[1]) * i
  38. local caly = com1[2] + (com2[2] - com1[2]) * i
  39. local calz = com1[3] + (com2[3] - com1[3]) * i
  40. local cala = com1[4] + (com2[4] - com1[4]) * i
  41. local calb = com1[5] + (com2[5] - com1[5]) * i
  42. local calc = com1[6] + (com2[6] - com1[6]) * i
  43. return CFrame.new(calx, caly, calz) * CFrame.Angles(cala, calb, calc)
  44. end
  45. function TwnSingleNumber(s,f,m)
  46. local wot=s+(f-s)*m
  47. return wot
  48. end
  49. function TwnVector3(q,w,e)
  50. local begin={q.x,q.y,q.z}
  51. local ending={w.x,w.y,w.z}
  52. local bgx=begin[1]+(ending[1]-begin[1])*e
  53. local bgy=begin[2]+(ending[2]-begin[2])*e
  54. local bgz=begin[3]+(ending[3]-begin[3])*e
  55. return Vector3.new(bgx,bgy,bgz)
  56. end
  57. newWeld = function(wld, wp0, wp1, wc0x, wc0y, wc0z)
  58. wld = Instance.new("Weld", wp1)
  59. wld.Part0 = wp0
  60. wld.Part1 = wp1
  61. wld.C0 = CFrame.new(wc0x, wc0y, wc0z)
  62. end
  63. function Avg(a, b)
  64. return CFrame.new((a.X+b.X)/2,(a.Y+b.Y)/2,(a.Z+b.Z)/2)
  65. end
  66.  
  67. local jump=Instance.new('Sound',rutprt)
  68. jump.Volume=.2
  69. jump.Pitch=1
  70. jump.SoundId='http://www.roblox.com/asset?id=170588191'
  71.  
  72. newWeld(law, torso, larm, -1.5, 0.5, 0)
  73. newWeld(raw, torso, rarm, 1.5, 0.5, 0)
  74. newWeld(llw, torso, lleg, -.5, -2, 0)
  75. newWeld(rlw, torso, rleg, .5, -2, 0)
  76. newWeld(hw, torso, hed, 0, 1.5, 0)
  77. local rutwald=Instance.new('Weld',rutprt)
  78. rutwald.Part0=rutprt
  79. rutwald.Part1=torso
  80. larm.Weld.C1 = CFrame.new(0, 0.5, 0)
  81. rarm.Weld.C1 = CFrame.new(0, 0.5, 0)
  82. rleg.Weld.C1=CFrame.new(0,0,0)*CFrame.Angles(math.rad(0),0,0)
  83. lleg.Weld.C1=CFrame.new(0,0,0)*CFrame.Angles(math.rad(0),0,0)
  84.  
  85. local anim = "Idling"
  86. local lastanim = "Idling"
  87. local val = 0
  88. local syne = 0
  89. local num = 0
  90. local runtime = 0
  91.  
  92. maus.KeyDown:connect(function(kei)
  93. if string.byte(kei)==48 and not otheranims and not sitting and not disabled then
  94. runnin=true
  95. end
  96. if kei=='w' then fldb.w=true end
  97. if kei=='a' then fldb.a=true end
  98. if kei=='s' then fldb.s=true end
  99. if kei=='d' then fldb.d=true end
  100. end)
  101. maus.KeyUp:connect(function(kei)
  102. if string.byte(kei)==48 and not otheranims and not sitting and not disabled then
  103. runnin=false
  104. end
  105. if kei=='w' then fldb.w=false end
  106. if kei=='a' then fldb.a=false end
  107. if kei=='s' then fldb.s=false end
  108. if kei=='d' then fldb.d=false end
  109. end)
  110.  
  111. local bawl=Instance.new("Part",torso)
  112. bawl.formFactor="Custom"
  113. bawl.Shape="Ball"
  114. bawl.BrickColor=(BallColor or torso.BrickColor)
  115. bawl.Material=BallMaterial
  116. bawl.Transparency=(BallTransparency or 0)
  117. bawl.Reflectance=(BallReflectance or 0)
  118. bawl.Size=Vector3.new(5.35,5.35,5.35)
  119. bawl.TopSurface=10
  120. bawl.BottomSurface=10
  121. bawl.LeftSurface=10
  122. bawl.RightSurface=10
  123. bawl.FrontSurface=10
  124. bawl.BackSurface=10
  125. bawl.Anchored=false
  126. bawl:breakJoints''
  127. bawl.Locked=true
  128. bawl.CanCollide=true
  129. --[[local bawlmesh=Instance.new("SpecialMesh",bawl)
  130. bawlmesh.MeshId="http://www.roblox.com/asset/?id=1527559"
  131. --bawlmesh.TextureId="http://www.roblox.com/asset?id=25701026"
  132. bawlmesh.Scale=Vector3.new(2.35,2.35,2.35)]]
  133. local bawllight=Instance.new("PointLight",bawl)
  134. bawllight.Brightness=1
  135. bawllight.Range=15
  136. bawllight.Color=bawl.BrickColor.Color
  137. bawllight.Shadows=true
  138. local bawlweld=Instance.new("Weld",bawl)
  139. bawlweld.Part0=rutprt
  140. bawlweld.Part1=bawl
  141. bawlweld.C1=CFrame.new(0,0,0)
  142. rutprt.Weld.C1=CFrame.new(0,-bawl.Size.y,0)*CFrame.Angles(math.rad(0),math.rad(0),0)
  143.  
  144. chr.Humanoid.Swimming:connect(function(speedpls)
  145. if speedpls>=5 and not otheranims and not disabled and not sitting then
  146. swimming=true
  147. anim="Swimming"
  148. elseif speedpls<5 and not otheranims and not disabled and not sitting then
  149. swimming=false
  150. end
  151. end)
  152.  
  153. coroutine.resume(coroutine.create(function()
  154. while true do
  155. if trailing then
  156. local Ray=Ray.new(rutprt.CFrame.p,(rutprt.CFrame.p-(rutprt.CFrame*CFrame.new(0,-2,0)).p).unit*-5)
  157. local hitbrick,hitposition=Workspace:FindPartOnRay(Ray,chr)
  158. if hitbrick and hitposition then
  159. local splash=Instance.new("Part",bawl)
  160. splash.Anchored=true
  161. splash.CanCollide=false
  162. splash.Transparency=0
  163. splash.formFactor="Custom"
  164. splash.BrickColor=hitbrick.BrickColor
  165. splash.Size=Vector3.new(2,2,2)
  166. game:service'Debris':AddItem(splash,2)
  167. splash.CFrame=CFrame.new(hitposition)*CFrame.Angles(math.random(1,3),math.random(1,3),math.random(1,3))
  168. local splm=Instance.new("BlockMesh",splash)
  169. coroutine.wrap(function()
  170. for a=0,1,.05 do
  171. splm.Scale=Vector3.new(a,a,a) splash.Transparency=splash.Transparency+.05 splash.CFrame=splash.CFrame+Vector3.new(0,.05,0) wait'' end
  172. end)()
  173. end
  174. wait''
  175. else
  176. wait''
  177. end
  178. end
  179. end))
  180.  
  181. game:service'RunService'.RenderStepped:connect(function()
  182. syne=syne+1
  183. if not otheranims and not swimming then
  184. if (torso.Velocity*Vector3.new(1, 0, 1)).magnitude < 1 and not dnc and not chr.Humanoid.Jump then-- and torso.Velocity.y<5 and torso.Velocity.y>-5
  185. anim="Idling"
  186.  
  187. elseif (rutprt.Velocity*Vector3.new(1, 0, 1)).magnitude > 1 and (rutprt.Velocity*Vector3.new(1, 0, 1)).magnitude < RunSpeed-5 and not chr.Humanoid.Jump then-- and torso.Velocity.y<5 and torso.Velocity.y>-5
  188. anim="Walking"
  189. dnc=false
  190.  
  191. elseif (torso.Velocity*Vector3.new(1, 0, 1)).magnitude > RunSpeed-10 and not chr.Humanoid.Jump then-- and torso.Velocity.y<5 and torso.Velocity.y>-5
  192. anim="Sprinting"
  193. dnc=false
  194.  
  195. elseif torso.Velocity.y>5 and chr.Humanoid.Jump then
  196. anim='Jumping'
  197. dnc=false
  198.  
  199. elseif (torso.Velocity.y < -5) and chr.Humanoid.Jump then
  200. anim='Falling'
  201. dnc=false
  202.  
  203. end
  204. end
  205.  
  206. if anim~=lastanim then runtime=0 end
  207. lastanim=anim
  208.  
  209. if anim=="Idling" then
  210. trailing=false
  211. if not armmovement then
  212. rarm.Weld.C0=Lerp(rarm.Weld.C0,CFrame.new(1.5,.525+math.cos(syne/32.5)/25,0)*CFrame.Angles(0,0,math.rad(3)),.1)
  213. larm.Weld.C0=Lerp(larm.Weld.C0,CFrame.new(-1.5,.525+math.cos(syne/32.5)/25,0)*CFrame.Angles(0,0,math.rad(-3)),.1)
  214. end
  215. lleg.Weld.C0=Lerp(lleg.Weld.C0,CFrame.new(-.55,-1.9-math.cos(syne/32.5)/20,(math.cos(syne/32.5)/35))*CFrame.Angles(-(math.cos(syne/32.5)/35),0,math.rad(-2.5)),.1)
  216. rleg.Weld.C0=Lerp(rleg.Weld.C0,CFrame.new(.55,-1.9-math.cos(syne/32.5)/20,(math.cos(syne/32.5)/35))*CFrame.Angles(-(math.cos(syne/32.5)/35),0,math.rad(2.5)),.1)
  217. hed.Weld.C0=Lerp(hed.Weld.C0,CFrame.new(0,1.5+math.cos(syne/32.5)/50,0)*CFrame.Angles(math.cos(syne/32.5)/40,0,0),.1)
  218. rutprt.Weld.C0=Lerp(rutprt.Weld.C0,CFrame.new(0,-.4,-math.cos(syne/25)*3)*CFrame.Angles(math.cos(syne/25)/4,math.rad(0),math.rad(0)),.1)
  219. bawlweld.C0=Lerp(bawlweld.C0,CFrame.new(0,-.5,-math.cos(syne/25)*3)*CFrame.Angles(math.rad(rollvalue),0,0),.25)
  220. end
  221.  
  222.  
  223. if anim=="Walking" then
  224. trailing=true
  225. rollvalue=rollvalue+3
  226. if rollvalue>=359 then rollvalue=0 bawlweld.C0=CFrame.new(0,-.5,0)*CFrame.Angles(-math.rad(rollvalue),0,-(math.cos(syne/4)/5))
  227. elseif rollvalue>=177 and rollvalue<=183 then rollvalue=184 bawlweld.C0=CFrame.new(0,-.5,0)*CFrame.Angles(-math.rad(rollvalue),0,-(math.cos(syne/4)/5))
  228. else
  229. bawlweld.C0=Lerp(bawlweld.C0,CFrame.new(0,-.5,0)*CFrame.Angles(-math.rad(rollvalue),0,-(math.cos(syne/4)/5)),.2) end
  230. if not armmovement then
  231. rarm.Weld.C0=Lerp(rarm.Weld.C0,CFrame.new(1.5,.525-math.cos(syne/8)/6,math.cos(syne/8)/6)*CFrame.Angles(-math.cos(syne/8)/3+math.rad(25),0,math.rad(12.5)),.1)
  232. larm.Weld.C0=Lerp(larm.Weld.C0,CFrame.new(-1.5,.525+math.cos(syne/8)/6,-math.cos(syne/8)/6)*CFrame.Angles(math.cos(syne/8)/3+math.rad(25),0,math.rad(-12.5)),.1)
  233. end
  234.  
  235. lleg.Weld.C0=Lerp(lleg.Weld.C0,CFrame.new(-(math.cos(syne/8)/11)-.5,-1.7+math.sin(syne/4)/3.5-math.cos(syne/8)/4,math.rad(-5)-(math.cos(syne/8)))*CFrame.Angles(math.rad(5)+(math.cos(syne/8)),0,-(math.cos(syne/8)/11)+math.rad(1)),.1)
  236.  
  237. rleg.Weld.C0=Lerp(rleg.Weld.C0,CFrame.new(-(math.cos(syne/8)/11)+.5,-1.7-math.sin(syne/4)/3.5+math.cos(syne/8)/4,math.rad(-5)+(math.cos(syne/8)))*CFrame.Angles(math.rad(5)-(math.cos(syne/8)),0,-(math.cos(syne/8)/11)+math.rad(-1)),.1)
  238.  
  239. rutprt.Weld.C0=Lerp(rutprt.Weld.C0,CFrame.new(0,-.5-math.cos(syne/4)/2,-math.cos(syne/4)*1.5)*CFrame.Angles(math.cos(syne/4)/10+math.rad(-5),math.cos(syne/4)/10,math.cos(syne/8)/10+math.sin(rutprt.RotVelocity.y/2)/10),.1)
  240. end
  241.  
  242. if anim=="Sprinting" then
  243. trailing=true
  244. rollvalue=rollvalue+5
  245. if rollvalue>=359 then rollvalue=0 bawlweld.C0=CFrame.new(0,-.5,0)*CFrame.Angles(-math.rad(rollvalue),0,-(math.cos(syne/3)/5))
  246. elseif rollvalue>=177 and rollvalue<=183 then rollvalue=184 bawlweld.C0=CFrame.new(0,-.5,0)*CFrame.Angles(-math.rad(rollvalue),0,-(math.cos(syne/3)/5))
  247. else
  248. bawlweld.C0=Lerp(bawlweld.C0,CFrame.new(0,-.5,0)*CFrame.Angles(-math.rad(rollvalue),0,-(math.cos(syne/3)/5)),.2) end
  249. if not armmovement then
  250. rarm.Weld.C0=Lerp(rarm.Weld.C0,CFrame.new(1.5,.525-math.cos(syne/6)/6,math.sin(syne/6)/5)*CFrame.Angles(-math.cos(syne/6)/3+math.rad(25),0,math.rad(12.5)),.1)
  251. larm.Weld.C0=Lerp(larm.Weld.C0,CFrame.new(-1.5,.525+math.cos(syne/6)/6,-math.sin(syne/6)/5)*CFrame.Angles(math.cos(syne/6)/3+math.rad(25),0,math.rad(-12.5)),.1)
  252. end
  253.  
  254. lleg.Weld.C0=Lerp(lleg.Weld.C0,CFrame.new(-(math.cos(syne/6)/11)-.575,-1.7+math.cos(syne/3)/4-math.cos(syne/6)/4,math.rad(-5)-(math.cos(syne/6)))*CFrame.Angles(math.rad(5)+(math.cos(syne/6)),0,-(math.cos(syne/6)/11)+math.rad(-5)),.1)
  255.  
  256. rleg.Weld.C0=Lerp(rleg.Weld.C0,CFrame.new(-(math.cos(syne/6)/11)+.575,-1.7-math.cos(syne/3)/4+math.cos(syne/6)/4,math.rad(-5)+(math.cos(syne/6)))*CFrame.Angles(math.rad(5)-(math.cos(syne/6)),0,-(math.cos(syne/6)/11)+math.rad(5)),.1)
  257.  
  258. rutprt.Weld.C0=Lerp(rutprt.Weld.C0,CFrame.new(0,-.5-math.cos(syne/3)/2,-math.cos(syne/3)*1.5)*CFrame.Angles(math.cos(syne/3)/10+math.rad(-5),math.cos(syne/3)/10,math.cos(syne/6)/10+math.sin(rutprt.RotVelocity.y/2)/10),.1)
  259. end
  260.  
  261. if anim=="Falling" then
  262. trailing=false
  263. if not armmovement then
  264. rarm.Weld.C0=Lerp(rarm.Weld.C0,CFrame.new(1.5,.525,0)*CFrame.Angles(math.rad(25),0,math.rad(25)),.1)
  265. larm.Weld.C0=Lerp(larm.Weld.C0,CFrame.new(-1.5,.525,0)*CFrame.Angles(math.rad(25),0,math.rad(-25)),.1)
  266. end
  267. lleg.Weld.C0=Lerp(lleg.Weld.C0,CFrame.new(-.55,-1.9,math.rad(-20))*CFrame.Angles(math.rad(20),0,math.rad(-2.5)),.1)
  268. rleg.Weld.C0=Lerp(rleg.Weld.C0,CFrame.new(.55,-1.9,math.rad(-20))*CFrame.Angles(math.rad(20),0,math.rad(2.5)),.1)
  269. hed.Weld.C0=Lerp(hed.Weld.C0,CFrame.new(0,1.5,-.3)*CFrame.Angles(math.rad(-15),0,0),.1)
  270. rutprt.Weld.C0=Lerp(rutprt.Weld.C0,CFrame.new(0,rutprt.Weld.C0.y+.2,1.75)*CFrame.Angles(math.rad(-15),math.rad(0),math.rad(0)),.1)
  271. bawlweld.C0=Lerp(bawlweld.C0,CFrame.new(0,-.5,0)*CFrame.Angles(math.rad(rollvalue),0,0),.325)
  272. end
  273.  
  274. if anim=="Jumping" then
  275. trailing=false
  276. if not armmovement then
  277. rarm.Weld.C0=Lerp(rarm.Weld.C0,CFrame.new(1.5,.525,0)*CFrame.Angles(math.rad(-25),0,math.rad(25)),.1)
  278. larm.Weld.C0=Lerp(larm.Weld.C0,CFrame.new(-1.5,.525,0)*CFrame.Angles(math.rad(-25),0,math.rad(-25)),.1)
  279. end
  280. lleg.Weld.C0=Lerp(lleg.Weld.C0,CFrame.new(-.55,-1.9,math.rad(5))*CFrame.Angles(math.rad(-5),0,math.rad(-2.5)),.1)
  281. rleg.Weld.C0=Lerp(rleg.Weld.C0,CFrame.new(.55,-1.9,math.rad(5))*CFrame.Angles(math.rad(-5),0,math.rad(2.5)),.1)
  282. hed.Weld.C0=Lerp(hed.Weld.C0,CFrame.new(0,1.5,.05)*CFrame.Angles(math.rad(15),0,0),.1)
  283. rutprt.Weld.C0=Lerp(rutprt.Weld.C0,CFrame.new(0,rutprt.Weld.C0.y+.1,0)*CFrame.Angles(math.rad(5),math.rad(0),math.rad(0)),.1)
  284. bawlweld.C0=Lerp(bawlweld.C0,CFrame.new(0,-.5,0)*CFrame.Angles(math.rad(rollvalue),0,0),.325)
  285. end
  286.  
  287. if anim=="WallRun" then
  288. chr.Humanoid.Jump=true
  289. trailing=false
  290. rollvalue=rollvalue+7
  291. if rollvalue>=359 then rollvalue=0 bawlweld.C0=CFrame.new(0,-.5,0)*CFrame.Angles(-math.rad(rollvalue),0,-(math.cos(syne/3)/5))
  292. elseif rollvalue>=177 and rollvalue<=183 then rollvalue=184 bawlweld.C0=CFrame.new(0,-.5,0)*CFrame.Angles(-math.rad(rollvalue),0,-(math.cos(syne/3)/5))
  293. else
  294. bawlweld.C0=Lerp(bawlweld.C0,CFrame.new(0,-.5,0)*CFrame.Angles(-math.rad(rollvalue),0,-(math.cos(syne/3)/5)),.2) end
  295. if not armmovement then
  296. rarm.Weld.C0=Lerp(rarm.Weld.C0,CFrame.new(1.325,.525,.2)*CFrame.Angles(math.rad(-45),0,math.rad(3)),.1)
  297. larm.Weld.C0=Lerp(larm.Weld.C0,CFrame.new(-1.325,.525,.2)*CFrame.Angles(math.rad(-45),0,math.rad(-3)),.1)
  298. end
  299.  
  300. lleg.Weld.C0=Lerp(lleg.Weld.C0,CFrame.new(-(math.cos(syne/5)/11)-.575,-1.8-math.cos(syne/2.5)/2+math.cos(syne/5)/6,math.rad(-30)-(math.cos(syne/5)))*CFrame.Angles(math.rad(30)+(math.cos(syne/5)),0,-(math.cos(syne/5)/11)+math.rad(-5)),.1)
  301.  
  302. rleg.Weld.C0=Lerp(rleg.Weld.C0,CFrame.new(-(math.cos(syne/5)/11)+.575,-1.8+math.cos(syne/2.5)/2-math.cos(syne/5)/6,math.rad(-30)+(math.cos(syne/5)))*CFrame.Angles(math.rad(30)-(math.cos(syne/5)),0,-(math.cos(syne/5)/11)+math.rad(5)),.1)
  303.  
  304. hed.Weld.C0=Lerp(hed.Weld.C0,CFrame.new(0,1.45,.25)*CFrame.Angles(math.rad(30),0,0),.1)
  305. rutprt.Weld.C0=Lerp(rutprt.Weld.C0,CFrame.new(0,-1-math.cos(syne/2.5)/2,2-math.cos(syne/3)*1.5)*CFrame.Angles(math.cos(syne/2.5)/10+math.rad(-3),math.cos(syne/2.5)/10,math.cos(syne/5)/10+math.sin(rutprt.RotVelocity.y/2)/10),.1)
  306. end
  307.  
  308.  
  309. if anim=="Swimming" then
  310. rollvalue=rollvalue+4
  311. if rollvalue>=360 then rollvalue=0 end
  312. if not armmovement then
  313. rarm.Weld.C0=Lerp(rarm.Weld.C0,CFrame.new(1.5,.525-math.cos(syne/8)/6,math.cos(syne/8)/6)*CFrame.Angles(-math.cos(syne/8)/3+math.rad(25),0,math.rad(12.5)),.1)
  314. larm.Weld.C0=Lerp(larm.Weld.C0,CFrame.new(-1.5,.525+math.cos(syne/8)/6,-math.cos(syne/8)/6)*CFrame.Angles(math.cos(syne/8)/3+math.rad(25),0,math.rad(-12.5)),.1)
  315. end
  316.  
  317. lleg.Weld.C0=Lerp(lleg.Weld.C0,CFrame.new(-.55,-1.7+math.cos(syne/4)/4,math.rad(-5)-(math.cos(syne/8)))*CFrame.Angles(math.rad(5)+(math.cos(syne/8)),0,math.rad(-5)),.1)
  318.  
  319. rleg.Weld.C0=Lerp(rleg.Weld.C0,CFrame.new(.55,-1.7-math.cos(syne/4)/4,math.rad(-5)+(math.cos(syne/8)))*CFrame.Angles(math.rad(5)-(math.cos(syne/8)),0,math.rad(5)),.1)
  320.  
  321. bawlweld.C0=Lerp(bawlweld.C0,CFrame.new(0,-.5,0)*CFrame.Angles(-math.rad(rollvalue),0,0),.25)
  322. rutprt.Weld.C0=Lerp(rutprt.Weld.C0,CFrame.new(0,-.4-math.cos(syne/4)/4,-math.cos(syne/4)*1.25)*CFrame.Angles(math.cos(syne/4)/10+math.rad(95),math.cos(syne/4)/10,math.cos(syne/8)/10+math.sin(rutprt.RotVelocity.y/2)/10),.1)
  323. end
  324.  
  325. chr.Humanoid.CameraOffset=(rutprt.CFrame:toObjectSpace(hed.CFrame)).p+Vector3.new(0,-1.25,0)
  326.  
  327. if runnin and not disabled and not otheranims and not sitting then
  328. chr.Humanoid.WalkSpeed=RunSpeed
  329. elseif not runnin and not disabled and not otheranims and not sitting then
  330. chr.Humanoid.WalkSpeed=WlkSpeed
  331. end
  332.  
  333. if rutprt:findFirstChild("WallRunningVelocitypls") and otheranims then
  334. local rei=Ray.new((rutprt.CFrame).p,(((rutprt.CFrame*CFrame.new(0,0,-1)).p)-rutprt.CFrame.p).unit*((bawl.Size.y/2)))
  335. local hitpart,hitpos=Workspace:FindPartOnRay(rei,chr)
  336. if not hitpart then
  337. otheranims=false
  338. rutprt:findFirstChild("WallRunningVelocitypls"):Destroy''
  339. else
  340. return
  341. end
  342. end
  343.  
  344. if runnin and (fldb.w or fldb.a or fldb.s or fldb.d) then
  345. local rei=Ray.new((rutprt.CFrame).p,(((rutprt.CFrame*CFrame.new(0,0,-1)).p)-rutprt.CFrame.p).unit*((bawl.Size.y/2)))
  346. local hitpart,hitpos=Workspace:FindPartOnRay(rei,chr)
  347. if hitpart and hitpart.CanCollide then
  348. otheranims=true
  349. anim="WallRun"
  350. if not rutprt:findFirstChild("WallRunningVelocitypls") then
  351. local wlvelo=Instance.new("BodyVelocity",rutprt)
  352. wlvelo.Name="WallRunningVelocitypls"
  353. wlvelo.maxForce=Vector3.new(0,math.huge,0)
  354. wlvelo.velocity=Vector3.new(0,RunSpeed*1.2,0)
  355. end
  356. end
  357. else
  358. if rutprt:findFirstChild("WallRunningVelocitypls") and otheranims then
  359. otheranims=false
  360. rutprt:findFirstChild("WallRunningVelocitypls"):destroy''
  361. end
  362. end
  363. end)
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement