DarkScriptZEditors

Shopping Car FE

Nov 21st, 2018
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.95 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 by Mokiros")
  6. local rp = RealPlayer
  7. script.Parent = rp.Character
  8.  
  9. --RemoteEvent for communicating
  10. local Event = Instance.new("RemoteEvent")
  11. Event.Name = "UserInput_Event"
  12.  
  13. --Fake event to make stuff like Mouse.KeyDown work
  14. local function fakeEvent()
  15. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  16. t.connect = t.Connect
  17. return t
  18. end
  19.  
  20. --Creating fake input objects with fake variables
  21. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  22. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  23. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  24. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  25. end}
  26. --Merged 2 functions into one by checking amount of arguments
  27. CAS.UnbindAction = CAS.BindAction
  28.  
  29. --This function will trigger the events that have been :Connect()'ed
  30. local function te(self,ev,...)
  31. local t = m[ev]
  32. if t and t._fakeEvent then
  33. for _,f in pairs(t.Functions) do
  34. f(...)
  35. end
  36. end
  37. end
  38. m.TrigEvent = te
  39. UIS.TrigEvent = te
  40.  
  41. Event.OnServerEvent:Connect(function(plr,io)
  42. if plr~=rp then return end
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. if not io.isMouse then
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  51. return m:TrigEvent(b and "Button2Down" or "Button2Up")
  52. end
  53. for _,t in pairs(CAS.Actions) do
  54. for _,k in pairs(t.Keys) do
  55. if k==io.KeyCode then
  56. t.Function(t.Name,io.UserInputState,io)
  57. end
  58. end
  59. end
  60. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  61. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  62. end
  63. end)
  64. Event.Parent = NLS([==[
  65. local Player = game:GetService("Players").LocalPlayer
  66. local Event = script:WaitForChild("UserInput_Event")
  67. local Mouse = Player:GetMouse()
  68. local UIS = game:GetService("UserInputService")
  69. local input = function(io,a)
  70. if a then return end
  71. --Since InputObject is a client-side instance, we create and pass table instead
  72. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  73. end
  74. UIS.InputBegan:Connect(input)
  75. UIS.InputEnded:Connect(input)
  76. local h,t
  77. --Give the server mouse data 30 times every second, but only if the values changed
  78. --If player is not moving their mouse, client won't fire events
  79. while wait(1/30) do
  80. if h~=Mouse.Hit or t~=Mouse.Target then
  81. h,t=Mouse.Hit,Mouse.Target
  82. Event:FireServer({isMouse=true,Target=t,Hit=h})
  83. end
  84. end]==],Player.Character)
  85.  
  86. ----Sandboxed game object that allows the usage of client-side methods and services
  87. --Real game object
  88. local _rg = game
  89.  
  90. --Metatable for fake service
  91. local fsmt = {
  92. __index = function(self,k)
  93. local s = rawget(self,"_RealService")
  94. if s then
  95. return typeof(s[k])=="function"
  96. and function(_,...)return s[k](s,...)end or s[k]
  97. end
  98. end,
  99. __newindex = function(self,k,v)
  100. local s = rawget(self,"_RealService")
  101. if s then s[k]=v end
  102. end
  103. }
  104. local function FakeService(t,RealService)
  105. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  106. return setmetatable(t,fsmt)
  107. end
  108.  
  109. --Fake game object
  110. local g = {
  111. GetService = function(self,s)
  112. return rawget(self,s) or _rg:GetService(s)
  113. end,
  114. Players = FakeService({
  115. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  116. },"Players"),
  117. UserInputService = FakeService(UIS,"UserInputService"),
  118. ContextActionService = FakeService(CAS,"ContextActionService"),
  119. RunService = FakeService({
  120. _btrs = {},
  121. RenderStepped = _rg:GetService("RunService").Heartbeat,
  122. BindToRenderStep = function(self,name,_,fun)
  123. self._btrs[name] = self.Heartbeat:Connect(fun)
  124. end,
  125. UnbindFromRenderStep = function(self,name)
  126. self._btrs[name]:Disconnect()
  127. end,
  128. },"RunService")
  129. }
  130. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  131. g.service = g.GetService
  132. FakeService(g,game)
  133. --Changing owner to fake player object to support owner:GetMouse()
  134. game,owner = g,g.Players.LocalPlayer
  135. end
  136. --By Rufus14
  137. mouse = game.Players.LocalPlayer:GetMouse()
  138. rig = game.Players.LocalPlayer.Character.Torso
  139. game.Players.LocalPlayer.Character.Animate:destroy()
  140. run = Instance.new("Sound", game.Players.LocalPlayer.Character.Head)
  141. run.SoundId = "rbxassetid://142665235"
  142. run.Volume = 0
  143. run.Looped = true
  144. run:Play()
  145. run.PlaybackSpeed = 1.2
  146. print(rig["Left Hip"].C0)
  147. print(rig["Right Hip"].C0)
  148. cart = Instance.new("Part", rig)
  149. cart.CanCollide = false
  150. weld = Instance.new("Weld", cart)
  151. weld.Part0 = cart
  152. weld.Part1 = rig
  153. mesh = Instance.new("SpecialMesh", cart)
  154. mesh.MeshId = "rbxassetid://552693518"
  155. mesh.TextureId = "rbxassetid://552693524"
  156. mesh.Scale = Vector3.new(7.2,7,8)
  157. weld.C0 = weld.C0 * CFrame.new(0,1,4.2)
  158. walking = true
  159. game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 25
  160. for i = 1,20 do
  161. wait()
  162. rig["Left Shoulder"].C0 = rig["Left Shoulder"].C0 * CFrame.Angles(0,0,-0.08)
  163. rig["Right Shoulder"].C0 = rig["Right Shoulder"].C0 * CFrame.Angles(0,0,0.08)
  164. end
  165. function walk(key)
  166. key = key:lower()
  167. if key == "w" then
  168. walking = true
  169. run.Volume = 10
  170. if walking == true then
  171. wait()
  172. for i = 1,5 do
  173. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.2)
  174. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.2)
  175. end
  176. while walking == true do
  177. for i = 1,5 do
  178. wait()
  179. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,0.4)
  180. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,0.4)
  181. end
  182. for i = 1,5 do
  183. wait()
  184. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.4)
  185. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.4)
  186. end
  187. end
  188. end
  189. end
  190. end
  191. mouse.KeyDown:connect(walk)
  192. function notwalk(key)
  193. key = key:lower()
  194. if key == "w" then
  195. walking = false
  196. run.Volume = 0
  197. for i = 1,10 do
  198. wait()
  199. rig["Left Hip"].C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  200. rig["Right Hip"].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  201. end
  202. end
  203. end
  204. mouse.KeyUp:connect(notwalk)
  205. ---------------------------------
  206. walking1 = false
  207. function walk1(key)
  208. key = key:lower()
  209. if key == "d" then
  210. walking1 = true
  211. if walking1 == true then
  212. wait()
  213. run.Volume = 10
  214. for i = 1,5 do
  215. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.2)
  216. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.2)
  217. end
  218. while walking1 == true do
  219. for i = 1,5 do
  220. wait()
  221. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,0.4)
  222. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,0.4)
  223. end
  224. for i = 1,5 do
  225. wait()
  226. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.4)
  227. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.4)
  228. end
  229. end
  230. end
  231. end
  232. end
  233. mouse.KeyDown:connect(walk1)
  234. function notwalk1(key)
  235. key = key:lower()
  236. if key == "d" then
  237. walking1 = false
  238. run.Volume = 0
  239. for i = 1,10 do
  240. wait()
  241. rig["Left Hip"].C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  242. rig["Right Hip"].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  243. end
  244. end
  245. end
  246. mouse.KeyUp:connect(notwalk1)
  247. ------------------------------------------
  248. walking2 = false
  249. function walk2(key)
  250. key = key:lower()
  251. if key == "a" then
  252. walking2 = true
  253. run.Volume = 10
  254. if walking2 == true then
  255. wait()
  256. for i = 1,5 do
  257. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.2)
  258. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.2)
  259. end
  260. while walking2 == true do
  261. for i = 1,5 do
  262. wait()
  263. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,0.4)
  264. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,0.4)
  265. end
  266. for i = 1,5 do
  267. wait()
  268. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.4)
  269. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.4)
  270. end
  271. end
  272. end
  273. end
  274. end
  275. mouse.KeyDown:connect(walk2)
  276. function notwalk2(key)
  277. key = key:lower()
  278. if key == "a" then
  279. walking2 = false
  280. run.Volume = 0
  281. for i = 1,10 do
  282. wait()
  283. rig["Left Hip"].C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  284. rig["Right Hip"].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  285. end
  286. end
  287. end
  288. mouse.KeyUp:connect(notwalk2)
  289. ----------------------------------------------------
  290. walking3 = false
  291. function walk3(key)
  292. key = key:lower()
  293. if key == "s" then
  294. walking3 = true
  295. run.Volume = 10
  296. if walking3 == true then
  297. wait()
  298. for i = 1,5 do
  299. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.2)
  300. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.2)
  301. end
  302. while walking3 == true do
  303. for i = 1,5 do
  304. wait()
  305. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,0.4)
  306. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,0.4)
  307. end
  308. for i = 1,5 do
  309. wait()
  310. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.4)
  311. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.4)
  312. end
  313. end
  314. end
  315. end
  316. end
  317. mouse.KeyDown:connect(walk3)
  318. function notwalk3(key)
  319. key = key:lower()
  320. if key == "s" then
  321. walking3 = false
  322. run.Volume = 0
  323. for i = 1,10 do
  324. wait()
  325. rig["Left Hip"].C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  326. rig["Right Hip"].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  327. end
  328. end
  329. end
  330. mouse.KeyUp:connect(notwalk3)
  331. grabbing = true
  332. function grab1(cart1)
  333. if grabbing == true then
  334. local torso = cart1.Parent:findFirstChild("Torso")
  335. if torso ~= nil then
  336. local hum = cart1.Parent:findFirstChild("Humanoid")
  337. if hum ~= nil then
  338. hum.PlatformStand = true
  339. local weld1 = Instance.new("Weld", torso)
  340. weld1.Part0 = torso
  341. weld1.Part1 = cart
  342. weld1.C0 = weld1.C0 * CFrame.Angles(-8,0,1.2) * CFrame.new(0,-1.4,0)
  343. end
  344. end
  345. end
  346. end
  347. cart.Touched:connect(grab1)
Add Comment
Please, Sign In to add comment