Advertisement
waconline

spider

Oct 27th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code V2 by Mokiros")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.Character
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local Disconnect_Function = function(this)
  12. this[1].Functions[this[2]] = nil
  13. end
  14. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15. local FakeEvent_Metatable = {__index={
  16. Connect = function(this,f)
  17. local i = tostring(math.random(0,10000))
  18. while this.Functions[i] do
  19. i = tostring(math.random(0,10000))
  20. end
  21. this.Functions[i] = f
  22. return setmetatable({this,i},Disconnect_Metatable)
  23. end
  24. }}
  25. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26. local function fakeEvent()
  27. return setmetatable({Functions={}},FakeEvent_Metatable)
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32. FakeMouse.keyUp = FakeMouse.KeyUp
  33. FakeMouse.keyDown = FakeMouse.KeyDown
  34. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37. end}
  38. --Merged 2 functions into one by checking amount of arguments
  39. CAS.UnbindAction = CAS.BindAction
  40.  
  41. --This function will trigger the events that have been :Connect()'ed
  42. local function TriggerEvent(self,ev,...)
  43. for _,f in pairs(self[ev].Functions) do
  44. f(...)
  45. end
  46. end
  47. FakeMouse.TriggerEvent = TriggerEvent
  48. UIS.TriggerEvent = TriggerEvent
  49.  
  50. --Client communication
  51. local Event = Instance.new("RemoteEvent")
  52. Event.Name = "UserInput_Event"
  53. Event.OnServerEvent:Connect(function(plr,io)
  54. if plr~=RealPlayer then return end
  55. FakeMouse.Target = io.Target
  56. FakeMouse.Hit = io.Hit
  57. if not io.isMouse then
  58. local b = io.UserInputState == Enum.UserInputState.Begin
  59. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61. end
  62. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64. end
  65. for _,t in pairs(CAS.Actions) do
  66. for _,k in pairs(t.Keys) do
  67. if k==io.KeyCode then
  68. t.Function(t.Name,io.UserInputState,io)
  69. end
  70. end
  71. end
  72. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74. end
  75. end)
  76. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77. local Mouse = owner:GetMouse()
  78. local UIS = game:GetService("UserInputService")
  79. local input = function(io,RobloxHandled)
  80. if RobloxHandled then return end
  81. --Since InputObject is a client-side instance, we create and pass table instead
  82. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83. end
  84. UIS.InputBegan:Connect(input)
  85. UIS.InputEnded:Connect(input)
  86.  
  87. local h,t
  88. --Give the server mouse data every second frame, but only if the values changed
  89. --If player is not moving their mouse, client won't fire events
  90. local HB = game:GetService("RunService").Heartbeat
  91. while true do
  92. if h~=Mouse.Hit or t~=Mouse.Target then
  93. h,t=Mouse.Hit,Mouse.Target
  94. Event:FireServer({isMouse=true,Target=t,Hit=h})
  95. end
  96. --Wait 2 frames
  97. for i=1,2 do
  98. HB:Wait()
  99. end
  100. end]==],script)
  101.  
  102. ----Sandboxed game object that allows the usage of client-side methods and services
  103. --Real game object
  104. local RealGame = game
  105.  
  106. --Metatable for fake service
  107. local FakeService_Metatable = {
  108. __index = function(self,k)
  109. local s = rawget(self,"_RealService")
  110. if s then
  111. return typeof(s[k])=="function"
  112. and function(_,...)return s[k](s,...)end or s[k]
  113. end
  114. end,
  115. __newindex = function(self,k,v)
  116. local s = rawget(self,"_RealService")
  117. if s then s[k]=v end
  118. end
  119. }
  120. local function FakeService(t,RealService)
  121. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  122. return setmetatable(t,FakeService_Metatable)
  123. end
  124.  
  125. --Fake game object
  126. local FakeGame = {
  127. GetService = function(self,s)
  128. return rawget(self,s) or RealGame:GetService(s)
  129. end,
  130. Players = FakeService({
  131. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  132. },"Players"),
  133. UserInputService = FakeService(UIS,"UserInputService"),
  134. ContextActionService = FakeService(CAS,"ContextActionService"),
  135. RunService = FakeService({
  136. _btrs = {},
  137. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  138. BindToRenderStep = function(self,name,_,fun)
  139. self._btrs[name] = self.Heartbeat:Connect(fun)
  140. end,
  141. UnbindFromRenderStep = function(self,name)
  142. self._btrs[name]:Disconnect()
  143. end,
  144. },"RunService")
  145. }
  146. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  147. FakeGame.service = FakeGame.GetService
  148. FakeService(FakeGame,game)
  149. --Changing owner to fake player object to support owner:GetMouse()
  150. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  151. end
  152.  
  153. CN, CA, V3, U2, C3, BN = CFrame.new, CFrame.Angles, Vector3.new, UDim2.new, Color3.new, BrickColor.new
  154. function new(instanceType, parent)
  155. return function(configuration)
  156. local newInstance = Instance.new(instanceType, parent)
  157. if newInstance:IsA("BasePart") then
  158. newInstance.TopSurface = 0
  159. newInstance.BottomSurface = 0
  160. if not newInstance:IsA("CornerWedgePart") then
  161. newInstance.FormFactor = 3
  162. end
  163. newInstance.Material = "Granite"
  164. newInstance.BrickColor = BN("Medium stone grey")
  165. newInstance.Locked = true
  166. end
  167. for property, value in pairs(configuration) do
  168. if type(value) == "function" then
  169. newInstance[property]:connect(value)
  170. else
  171. newInstance[property] = value
  172. end
  173. end
  174. if configuration["CFrame"] then
  175. newInstance.CFrame = configuration["CFrame"]
  176. end
  177. return newInstance
  178. end
  179. end
  180. function QuaternionFromCFrame(cf)
  181. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  182. local trace = m00+m11+m22
  183. if trace > 0 then
  184. local s = math.sqrt(1+trace)
  185. local recip = 0.5/s
  186. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  187. else
  188. local i = 0
  189. if m11 > m00 then
  190. i = 1
  191. end
  192. if m22 > (i == 0 and m00 or m11) then
  193. i = 2
  194. end
  195. if i == 0 then
  196. local s = math.sqrt(m00-m11-m22+1)
  197. local recip = 0.5/s
  198. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  199. elseif i == 1 then
  200. local s = math.sqrt(m11-m22-m00+1)
  201. local recip = 0.5/s
  202. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  203. elseif i == 2 then
  204. local s = math.sqrt(m22-m00-m11+1)
  205. local recip = 0.5/s
  206. return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  207. end
  208. end
  209. end
  210. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  211. local xs, ys, zs = x+x, y+y, z+z
  212. local wx, wy, wz = w*xs, w*ys, w*zs
  213. local xx = x*xs
  214. local xy = x*ys
  215. local xz = x*zs
  216. local yy = y*ys
  217. local yz = y*zs
  218. local zz = z*zs
  219. 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))
  220. end
  221. function QuaternionSlerp(a, b, t)
  222. local cosTheta = a[1]*b[1]+a[2]*b[2]+a[3]*b[3]+a[4]*b[4]
  223. local startInterp, finishInterp;
  224. if cosTheta >= 0.0001 then
  225. if (1-cosTheta) > 0.0001 then
  226. local theta = math.acos(cosTheta)
  227. local invSinTheta = 1/math.sin(theta)
  228. startInterp = math.sin((1-t)*theta)*invSinTheta
  229. finishInterp = math.sin(t*theta)*invSinTheta
  230. else
  231. startInterp = 1-t
  232. finishInterp = t
  233. end
  234. else
  235. if (1+cosTheta) > 0.0001 then
  236. local theta = math.acos(-cosTheta)
  237. local invSinTheta = 1/math.sin(theta)
  238. startInterp = math.sin((t-1)*theta)*invSinTheta
  239. finishInterp = math.sin(t*theta)*invSinTheta
  240. else
  241. startInterp = t-1
  242. finishInterp = t
  243. end
  244. end
  245. 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
  246. end
  247. function Lerp(a, b, t)
  248. local qa = {QuaternionFromCFrame(a)}
  249. local qb = {QuaternionFromCFrame(b)}
  250. local ax, ay, az = a.x, a.y, a.z
  251. local bx, by, bz = b.x, b.y, b.z
  252. local _t = 1-t
  253. return QuaternionToCFrame(_t*ax+t*bx, _t*ay+t*by, _t*az+t*bz, QuaternionSlerp(qa, qb, t))
  254. end
  255.  
  256. for _, Obj in pairs(Workspace:GetChildren()) do
  257. if Obj.Name == "Awesome scary spider" then
  258. Obj:Destroy()
  259. end
  260. end
  261.  
  262. Offset = V3(25, -0.9, 25)
  263. SpiderColor = "Maroon"
  264.  
  265. Spider = new("Model", game.Players.LocalPlayer.Character){Name = "Awesome scary spider"}
  266. Platform = new("Part", Spider){Size = V3(30, 1, 30), BrickColor = BN("Really red"), Transparency = 1, CanCollide = true}
  267.  
  268. Torso = new("Part", Spider){Size = V3(4, 4, 6), Name = "Torso", BrickColor = BN(SpiderColor), Transparency = 1}
  269. new("BlockMesh", Torso){Scale = V3(1, 1, 1)}
  270. new("Motor6D", Platform){Part0 = Platform, Part1 = Torso, C0 = CN(0, 5, 0)}
  271. TorsoA = new("Part", Spider){Size = V3(4, 5, 3), BrickColor = BN(SpiderColor)}
  272. new("SpecialMesh", TorsoA){MeshType = "Sphere", Scale = V3(1.5, 1.5, 1.5)}
  273. new("Motor6D", Torso){Part0 = Torso, Part1 = TorsoA, C0 = CA(math.rad(90), 0, 0)}
  274.  
  275. Head = new("Part", Spider){Size = V3(2, 2, 2), Name = "Head", BrickColor = BN(SpiderColor), Transparency = 1}
  276. new("SpecialMesh", Head){MeshType = "Sphere", Scale = V3(1.5, 1.5, 1.5)}
  277. Neck = new("Motor6D", Torso){Part0 = Torso, Part1 = Head, C0 = CN(0, 0, -4), Name = "Neck"}
  278.  
  279. FakeHead = new("Part", Spider){Size = V3(2, 2, 2), BrickColor = BN(SpiderColor)}
  280. new("SpecialMesh", FakeHead){MeshType = "Sphere", Scale = V3(1.5, 1.5, 1.5)}
  281. new("Motor6D", Head){Part0 = Head, Part1 = FakeHead, C0 = CN()}
  282.  
  283. RightEye = new("Part", Spider){Size = V3(0.5, 0.5, 0.5), BrickColor = BN("White")}
  284. new("SpecialMesh", RightEye){MeshType = "Sphere", Scale = V3(1, 1, 1)}
  285. new("Motor6D", Head){Part0 = Head, Part1 = RightEye, C0 = CN(0.5, 0.25, -1.25)}
  286.  
  287. LeftEye = new("Part", Spider){Size = V3(0.5, 0.5, 0.5), BrickColor = BN("White")}
  288. new("SpecialMesh", LeftEye){MeshType = "Sphere", Scale = V3(1, 1, 1)}
  289. new("Motor6D", Head){Part0 = Head, Part1 = LeftEye, C0 = CN(-0.5, 0.25, -1.25)}
  290.  
  291. Torso2 = new("Part", Spider){Size = V3(5.5, 4.3, 7), BrickColor = BN(SpiderColor)}
  292. new("Motor6D", Torso){Part0 = Torso, Part1 = Torso2, C0 = CN(0, 0, 7)}
  293. new("SpecialMesh", Torso2){MeshType = "Sphere", Scale = V3(1.5, 1.5, 1.5)}
  294.  
  295. RightLegs = {}
  296. LeftLegs = {}
  297.  
  298. for L = 1, 4 do
  299. local RightLeg = new("Part", Spider){Size = V3(1, 5, 1), BrickColor = BN(SpiderColor)}
  300. new("CylinderMesh", RightLeg){Scale = V3(1, 1, 1)}
  301. new("Motor6D", RightLeg){Part0 = Torso, Part1 = RightLeg, C0 = CN(1.5, -1.5, -2+L)*CA(0, math.rad(45-L*15), math.rad(-60))*CN(0, 2.5, 0)}
  302. local RightLeg2 = new("Part", Spider){Size = V3(0.8, 5, 0.8), BrickColor = BN(SpiderColor)}
  303. new("CylinderMesh", RightLeg2){Scale = V3(1, 1, 1)}
  304. new("Motor6D", RightLeg2){Part0 = RightLeg, Part1 = RightLeg2, C0 = CN(0, 2.1, 0)*CA(0, 0, math.rad(-45))*CN(0, 2.5, 0)}
  305. local RightLeg3 = new("Part", Spider){Size = V3(0.6, 5, 0.6), BrickColor = BN(SpiderColor)}
  306. new("CylinderMesh", RightLeg3){Scale = V3(1, 1, 1)}
  307. new("Motor6D", RightLeg3){Part0 = RightLeg2, Part1 = RightLeg3, C0 = CN(0, 2.2, 0)*CA(0, 0, math.rad(-75))*CN(0, 2.5, 0)}
  308. table.insert(RightLegs, {RightLeg, RightLeg2, RightLeg3})
  309.  
  310. local LeftLeg = new("Part", Spider){Size = V3(1, 5, 1), BrickColor = BN(SpiderColor)}
  311. new("CylinderMesh", LeftLeg){Scale = V3(1, 1, 1)}
  312. new("Motor6D", LeftLeg){Part0 = Torso, Part1 = LeftLeg, C0 = CN(-1.5, -1.5, -2+L)*CA(0, math.rad(-45+L*15), math.rad(60))*CN(0, 2.5, 0)}
  313. local LeftLeg2 = new("Part", Spider){Size = V3(0.8, 5, 0.8), BrickColor = BN(SpiderColor)}
  314. new("CylinderMesh", LeftLeg2){Scale = V3(1, 1, 1)}
  315. new("Motor6D", LeftLeg2){Part0 = LeftLeg, Part1 = LeftLeg2, C0 = CN(0, 2.1, 0)*CA(0, 0, math.rad(45))*CN(0, 2.5, 0)}
  316. local LeftLeg3 = new("Part", Spider){Size = V3(0.6, 5, 0.6), BrickColor = BN(SpiderColor)}
  317. new("CylinderMesh", LeftLeg3){Scale = V3(1, 1, 1)}
  318. new("Motor6D", LeftLeg3){Part0 = LeftLeg2, Part1 = LeftLeg3, C0 = CN(0, 2.2, 0)*CA(0, 0, math.rad(75))*CN(0, 2.5, 0)}
  319. table.insert(LeftLegs, {LeftLeg, LeftLeg2, LeftLeg3})
  320. end
  321.  
  322. SpiderHumanoid = new("Humanoid", Spider){WalkSpeed = 30}
  323. Spider:MakeJoints()
  324. Platform.CFrame = CN(Offset)
  325.  
  326. SpiderVelocity = new("BodyVelocity", Platform){maxForce = V3(1/0, 1/0, 1/0)}
  327. SpiderGyro = new("BodyGyro", Platform){maxTorque = V3(1/0, 1/0, 1/0), P = 1000, D = 100}
  328.  
  329. --Now, on to the fun stuffs..
  330.  
  331. Player = owner
  332. Mouse = Player:GetMouse()
  333. UserInputService = Game:GetService("UserInputService")
  334. Camera = Workspace.CurrentCamera
  335.  
  336. --Camera.CameraType = "Scriptable"
  337.  
  338. Character = Player.Character
  339. Character:WaitForChild("Animate"):Destroy()
  340. CharacterHumanoid, CharacterTorso = Character:WaitForChild("Humanoid"), Character:WaitForChild("Torso")
  341. CharacterHumanoid.PlatformStand = true
  342. CharacterHumanoid.Changed:connect(function()
  343. CharacterHumanoid.PlatformStand = true
  344. CharacterHumanoid.Jump = false
  345. end)
  346. new("Motor6D", Torso){Part0 = Torso, Part1 = CharacterTorso, C0 = CN(0, 5, 0)}
  347.  
  348. Chatting = false
  349. Moving = false
  350. MaxSpeed = 30
  351. Acceleration = 1
  352. Deceleration = 1
  353. SpeedW = 0
  354. SpeedA = 0
  355. SpeedS = 0
  356. SpeedD = 0
  357. Velocity = V3()
  358. CameraAngleX, CameraAngleY = 45, 45
  359. Dragging = false
  360. Keys = {}
  361.  
  362. UserInputService.InputBegan:connect(function(Input)
  363. local Key, InputType, Delta = Input.KeyCode.Name, Input.UserInputType.Name, Input.Delta
  364. if Key == "Slash" and not Chatting then
  365. Chatting = true
  366. Keys = {}
  367. elseif Key == "Return" and Chatting then
  368. Chatting = false
  369. elseif (Key == "W" or Key == "A" or Key == "S" or Key == "D") and not Chatting then
  370. Keys[Key] = true
  371. end
  372. --[[ if InputType == "MouseButton2" then
  373. Dragging = true
  374. UserInputService.MouseBehavior = "LockCurrentPosition"
  375. end]]
  376. end)
  377.  
  378. --[[UserInputService.InputChanged:connect(function(Input)
  379. local Key, InputType, Delta, Position = Input.KeyCode.Name, Input.UserInputType.Name, Input.Delta, Input.Position
  380. if InputType == "MouseMovement" and Dragging then
  381. CameraAngleX = CameraAngleX+Delta.Y*0.2
  382. if CameraAngleX > 80 then
  383. CameraAngleX = 80
  384. elseif CameraAngleX < -80 then
  385. CameraAngleX = -80
  386. end
  387. CameraAngleY = CameraAngleY-Delta.X*0.2
  388. end
  389. end)]]
  390.  
  391. UserInputService.InputEnded:connect(function(Input)
  392. local Key, InputType, Delta = Input.KeyCode.Name, Input.UserInputType.Name, Input.Delta
  393. if (Key == "W" or Key == "A" or Key == "S" or Key == "D") and not Chatting then
  394. Keys[Key] = nil
  395. end
  396. if InputType == "MouseButton2" then
  397. Dragging = false
  398. UserInputService.MouseBehavior = "Default"
  399. end
  400. end)
  401.  
  402. function UpdateVelocity()
  403. if Keys["W"] then
  404. if SpeedW < MaxSpeed then
  405. SpeedW = SpeedW+Acceleration
  406. else
  407. SpeedW = MaxSpeed
  408. end
  409. else
  410. if SpeedW > 0 then
  411. SpeedW = SpeedW-Deceleration
  412. else
  413. SpeedW = 0
  414. end
  415. end
  416. if Keys["A"] then
  417. if SpeedA < MaxSpeed then
  418. SpeedA = SpeedA+Acceleration
  419. else
  420. SpeedA = MaxSpeed
  421. end
  422. else
  423. if SpeedA > 0 then
  424. SpeedA = SpeedA-Deceleration
  425. else
  426. SpeedA = 0
  427. end
  428. end
  429. if Keys["S"] then
  430. if SpeedS < MaxSpeed then
  431. SpeedS = SpeedS+Acceleration
  432. else
  433. SpeedS = MaxSpeed
  434. end
  435. else
  436. if SpeedS > 0 then
  437. SpeedS = SpeedS-Deceleration
  438. else
  439. SpeedS = 0
  440. end
  441. end
  442. if Keys["D"] then
  443. if SpeedD < MaxSpeed then
  444. SpeedD = SpeedD+Acceleration
  445. else
  446. SpeedD = MaxSpeed
  447. end
  448. else
  449. if SpeedD > 0 then
  450. SpeedD = SpeedD-Deceleration
  451. else
  452. SpeedD = 0
  453. end
  454. end
  455. Velocity = V3(SpeedD-SpeedA, 0, SpeedS-SpeedW)
  456. end
  457.  
  458. Game:GetService("RunService").Stepped:connect(function(Time)
  459. --Animation
  460. if Moving then
  461. for L, Leg in pairs(RightLegs) do
  462. local RightLeg1 = Leg[1]
  463. local RightLeg2 = Leg[2]
  464. local RightLeg3 = Leg[3]
  465.  
  466. local LeftLeg1 = LeftLegs[L][1]
  467. local LeftLeg2 = LeftLegs[L][2]
  468. local LeftLeg3 = LeftLegs[L][3]
  469.  
  470. local Mult = 1-L%2*2
  471.  
  472. --C0 = CN(-1.5, -1.5, -2+L)*CA(0, math.rad(-45+L*15), math.rad(45))*CN(0, 2.5, 0)
  473. --C0 = CN(0, 2.1, 0)*CA(0, 0, math.rad(60))*CN(0, 2.5, 0)
  474. --C0 = CN(0, 2.2, 0)*CA(0, 0, math.rad(60))*CN(0, 2.5, 0)
  475.  
  476. RightLeg1.Motor6D.C0 = Lerp(RightLeg1.Motor6D.C0, CN(1.5, -1.5, -2+L)*CA(0, math.rad(45-L*15+math.sin(Time*20)*Mult*30), math.rad(-45+math.sin(Time*20)*Mult*30))*CN(0, 2.5, 0), 0.1)
  477. LeftLeg1.Motor6D.C0 = Lerp(LeftLeg1.Motor6D.C0, CN(-1.5, -1.5, -2+L)*CA(0, math.rad(-45+L*15+math.sin(Time*20)*Mult*-30), math.rad(45+math.sin(Time*20)*Mult*-30))*CN(0, 2.5, 0), 0.1)
  478. end
  479. else
  480. for L, Leg in pairs(RightLegs) do
  481. local RightLeg1 = Leg[1]
  482. local RightLeg2 = Leg[2]
  483. local RightLeg3 = Leg[3]
  484.  
  485. local LeftLeg1 = LeftLegs[L][1]
  486. local LeftLeg2 = LeftLegs[L][2]
  487. local LeftLeg3 = LeftLegs[L][3]
  488.  
  489. local Mult = 1-L%2*2
  490.  
  491. --C0 = CN(-1.5, -1.5, -2+L)*CA(0, math.rad(-45+L*15), math.rad(45))*CN(0, 2.5, 0)
  492. --C0 = CN(0, 2.1, 0)*CA(0, 0, math.rad(60))*CN(0, 2.5, 0)
  493. --C0 = CN(0, 2.2, 0)*CA(0, 0, math.rad(60))*CN(0, 2.5, 0)
  494.  
  495. RightLeg1.Motor6D.C0 = Lerp(RightLeg1.Motor6D.C0, CN(1.5, -1.5, -2+L)*CA(0, math.rad(45-L*15), math.rad(-45))*CN(0, 2.5, 0), 0.25)
  496. LeftLeg1.Motor6D.C0 = Lerp(LeftLeg1.Motor6D.C0, CN(-1.5, -1.5, -2+L)*CA(0, math.rad(-45+L*15), math.rad(45))*CN(0, 2.5, 0), 0.25)
  497. end
  498. end
  499. end)
  500. Game:GetService("RunService").RenderStepped:connect(function()
  501. UpdateVelocity()
  502. if math.abs(SpiderVelocity.velocity.X) > 0 or math.abs(SpiderVelocity.velocity.Z) > 0 then
  503. Moving = true
  504. else
  505. Moving = false
  506. end
  507. local CoordinateFrame2D = CN(V3(Camera.CoordinateFrame.X, Platform.CFrame.Y, Camera.CoordinateFrame.Z), Platform.Position)
  508. local RelativeVelocity = CoordinateFrame2D*Velocity-CoordinateFrame2D.p
  509. SpiderVelocity.velocity = RelativeVelocity
  510. SpiderGyro.cframe = CN(CoordinateFrame2D.p, Platform.Position)
  511.  
  512. --Camera:Interpolate(CN(Torso.Position)*CA(0, math.rad(CameraAngleY), 0)*CA(math.rad(CameraAngleX), 0, 0)*CN(0, 0, -20), Torso.CFrame, 0.01)
  513. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement