Advertisement
Mediakiller7Cool

lalala

May 11th, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.71 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. --By Rufus14
  151. mouse = game.Players.LocalPlayer:GetMouse()
  152. rig = game.Players.LocalPlayer.Character.Torso
  153. game.Players.LocalPlayer.Character.Animate:destroy()
  154. run = Instance.new("Sound", game.Players.LocalPlayer.Character.Head)
  155. run.SoundId = "rbxassetid://142665235"
  156. run.Volume = 0
  157. run.Looped = true
  158. run:Play()
  159. run.PlaybackSpeed = 1.2
  160. print(rig["Left Hip"].C0)
  161. print(rig["Right Hip"].C0)
  162. cart = Instance.new("Part", rig)
  163. cart.CanCollide = false
  164. weld = Instance.new("Weld", cart)
  165. weld.Part0 = cart
  166. weld.Part1 = rig
  167. mesh = Instance.new("SpecialMesh", cart)
  168. mesh.MeshId = "rbxassetid://552693518"
  169. mesh.TextureId = "rbxassetid://552693524"
  170. mesh.Scale = Vector3.new(7.2,7,8)
  171. weld.C0 = weld.C0 * CFrame.new(0,1,4.2)
  172. walking = true
  173. game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 25
  174. for i = 1,20 do
  175. wait()
  176. rig["Left Shoulder"].C0 = rig["Left Shoulder"].C0 * CFrame.Angles(0,0,-0.08)
  177. rig["Right Shoulder"].C0 = rig["Right Shoulder"].C0 * CFrame.Angles(0,0,0.08)
  178. end
  179. function walk(key)
  180. key = key:lower()
  181. if key == "w" then
  182. walking = true
  183. run.Volume = 10
  184. if walking == true then
  185. wait()
  186. for i = 1,5 do
  187. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.2)
  188. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.2)
  189. end
  190. while walking == true do
  191. for i = 1,5 do
  192. wait()
  193. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,0.4)
  194. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,0.4)
  195. end
  196. for i = 1,5 do
  197. wait()
  198. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.4)
  199. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.4)
  200. end
  201. end
  202. end
  203. end
  204. end
  205. mouse.KeyDown:connect(walk)
  206. function notwalk(key)
  207. key = key:lower()
  208. if key == "w" then
  209. walking = false
  210. run.Volume = 0
  211. for i = 1,10 do
  212. wait()
  213. rig["Left Hip"].C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  214. rig["Right Hip"].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  215. end
  216. end
  217. end
  218. mouse.KeyUp:connect(notwalk)
  219. ---------------------------------
  220. walking1 = false
  221. function walk1(key)
  222. key = key:lower()
  223. if key == "d" then
  224. walking1 = true
  225. if walking1 == true then
  226. wait()
  227. run.Volume = 10
  228. for i = 1,5 do
  229. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.2)
  230. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.2)
  231. end
  232. while walking1 == true do
  233. for i = 1,5 do
  234. wait()
  235. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,0.4)
  236. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,0.4)
  237. end
  238. for i = 1,5 do
  239. wait()
  240. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.4)
  241. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.4)
  242. end
  243. end
  244. end
  245. end
  246. end
  247. mouse.KeyDown:connect(walk1)
  248. function notwalk1(key)
  249. key = key:lower()
  250. if key == "d" then
  251. walking1 = false
  252. run.Volume = 0
  253. for i = 1,10 do
  254. wait()
  255. rig["Left Hip"].C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  256. rig["Right Hip"].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  257. end
  258. end
  259. end
  260. mouse.KeyUp:connect(notwalk1)
  261. ------------------------------------------
  262. walking2 = false
  263. function walk2(key)
  264. key = key:lower()
  265. if key == "a" then
  266. walking2 = true
  267. run.Volume = 10
  268. if walking2 == true then
  269. wait()
  270. for i = 1,5 do
  271. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.2)
  272. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.2)
  273. end
  274. while walking2 == true do
  275. for i = 1,5 do
  276. wait()
  277. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,0.4)
  278. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,0.4)
  279. end
  280. for i = 1,5 do
  281. wait()
  282. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.4)
  283. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.4)
  284. end
  285. end
  286. end
  287. end
  288. end
  289. mouse.KeyDown:connect(walk2)
  290. function notwalk2(key)
  291. key = key:lower()
  292. if key == "a" then
  293. walking2 = false
  294. run.Volume = 0
  295. for i = 1,10 do
  296. wait()
  297. rig["Left Hip"].C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  298. rig["Right Hip"].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  299. end
  300. end
  301. end
  302. mouse.KeyUp:connect(notwalk2)
  303. ----------------------------------------------------
  304. walking3 = false
  305. function walk3(key)
  306. key = key:lower()
  307. if key == "s" then
  308. walking3 = true
  309. run.Volume = 10
  310. if walking3 == true then
  311. wait()
  312. for i = 1,5 do
  313. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.2)
  314. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.2)
  315. end
  316. while walking3 == true do
  317. for i = 1,5 do
  318. wait()
  319. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,0.4)
  320. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,0.4)
  321. end
  322. for i = 1,5 do
  323. wait()
  324. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.4)
  325. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.4)
  326. end
  327. end
  328. end
  329. end
  330. end
  331. mouse.KeyDown:connect(walk3)
  332. function notwalk3(key)
  333. key = key:lower()
  334. if key == "s" then
  335. walking3 = false
  336. run.Volume = 0
  337. for i = 1,10 do
  338. wait()
  339. rig["Left Hip"].C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  340. rig["Right Hip"].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  341. end
  342. end
  343. end
  344. mouse.KeyUp:connect(notwalk3)
  345. grabbing = true
  346. function grab1(cart1)
  347. if grabbing == true then
  348. local torso = cart1.Parent:findFirstChild("Torso")
  349. if torso ~= nil then
  350. local hum = cart1.Parent:findFirstChild("Humanoid")
  351. if hum ~= nil then
  352. hum.PlatformStand = true
  353. local weld1 = Instance.new("Weld", torso)
  354. weld1.Part0 = torso
  355. weld1.Part1 = cart
  356. weld1.C0 = weld1.C0 * CFrame.Angles(-8,0,1.2) * CFrame.new(0,-1.4,0)
  357. end
  358. end
  359. end
  360. end
  361. cart.Touched:connect(grab1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement