Advertisement
Mediakiller7Cool

Test15

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