Advertisement
therainbowcreeperRBX

Rufus's Shopping Cart FE

Oct 20th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --By Rufus14
  2. -- This script has been converted to FE by iPxter
  3.  
  4.  
  5. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  6. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  7. do
  8. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  9. script.Parent = Player.Character
  10.  
  11. --RemoteEvent for communicating
  12. local Event = Instance.new("RemoteEvent")
  13. Event.Name = "UserInput_Event"
  14.  
  15. --Fake event to make stuff like Mouse.KeyDown work
  16. local function fakeEvent()
  17. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  18. t.connect = t.Connect
  19. return t
  20. end
  21.  
  22. --Creating fake input objects with fake variables
  23. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  24. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  25. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  26. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  27. end}
  28. --Merged 2 functions into one by checking amount of arguments
  29. CAS.UnbindAction = CAS.BindAction
  30.  
  31. --This function will trigger the events that have been :Connect()'ed
  32. local function te(self,ev,...)
  33. local t = m[ev]
  34. if t and t._fakeEvent and t.Function then
  35. t.Function(...)
  36. end
  37. end
  38. m.TrigEvent = te
  39. UIS.TrigEvent = te
  40.  
  41. Event.OnServerEvent:Connect(function(plr,io)
  42. if plr~=Player then return end
  43. if io.isMouse then
  44. m.Target = io.Target
  45. m.Hit = io.Hit
  46. else
  47. local b = io.UserInputState == Enum.UserInputState.Begin
  48. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  49. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  50. end
  51. for _,t in pairs(CAS.Actions) do
  52. for _,k in pairs(t.Keys) do
  53. if k==io.KeyCode then
  54. t.Function(t.Name,io.UserInputState,io)
  55. end
  56. end
  57. end
  58. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  59. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  60. end
  61. end)
  62. Event.Parent = NLS([==[
  63. local Player = game:GetService("Players").LocalPlayer
  64. local Event = script:WaitForChild("UserInput_Event")
  65.  
  66. local UIS = game:GetService("UserInputService")
  67. local input = function(io,a)
  68. if a then return end
  69. --Since InputObject is a client-side instance, we create and pass table instead
  70. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  71. end
  72. UIS.InputBegan:Connect(input)
  73. UIS.InputEnded:Connect(input)
  74.  
  75. local Mouse = Player:GetMouse()
  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. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  86. end
  87.  
  88. rig = owner.Character.Torso
  89. owner.Character.Animate:destroy()
  90. run = Instance.new("Sound", owner.Character.Head)
  91. run.SoundId = "rbxassetid://142665235"
  92. run.Volume = 0
  93. run.Looped = true
  94. run:Play()
  95. run.PlaybackSpeed = 1.2
  96. print(rig["Left Hip"].C0)
  97. print(rig["Right Hip"].C0)
  98. cart = Instance.new("Part", rig)
  99. cart.CanCollide = false
  100. weld = Instance.new("Weld", cart)
  101. weld.Part0 = cart
  102. weld.Part1 = rig
  103. mesh = Instance.new("SpecialMesh", cart)
  104. mesh.MeshId = "rbxassetid://552693518"
  105. mesh.TextureId = "rbxassetid://552693524"
  106. mesh.Scale = Vector3.new(7.2,7,8)
  107. weld.C0 = weld.C0 * CFrame.new(0,1,4.2)
  108. walking = true
  109. owner.Character.Humanoid.WalkSpeed = 25
  110. for i = 1,20 do
  111. wait()
  112. rig["Left Shoulder"].C0 = rig["Left Shoulder"].C0 * CFrame.Angles(0,0,-0.08)
  113. rig["Right Shoulder"].C0 = rig["Right Shoulder"].C0 * CFrame.Angles(0,0,0.08)
  114. end
  115. function walk(key)
  116. key = key:lower()
  117. if key == "w" then
  118. walking = true
  119. run.Volume = 10
  120. if walking == true then
  121. wait()
  122. for i = 1,5 do
  123. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.2)
  124. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.2)
  125. end
  126. while walking == true do
  127. for i = 1,5 do
  128. wait()
  129. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,0.4)
  130. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,0.4)
  131. end
  132. for i = 1,5 do
  133. wait()
  134. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.4)
  135. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.4)
  136. end
  137. end
  138. end
  139. end
  140. end
  141. mouse.KeyDown:connect(walk)
  142. function notwalk(key)
  143. key = key:lower()
  144. if key == "w" then
  145. walking = false
  146. run.Volume = 0
  147. for i = 1,10 do
  148. wait()
  149. rig["Left Hip"].C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  150. rig["Right Hip"].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  151. end
  152. end
  153. end
  154. mouse.KeyUp:connect(notwalk)
  155. ---------------------------------
  156. walking1 = false
  157. function walk1(key)
  158. key = key:lower()
  159. if key == "d" then
  160. walking1 = true
  161. if walking1 == true then
  162. wait()
  163. run.Volume = 10
  164. for i = 1,5 do
  165. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.2)
  166. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.2)
  167. end
  168. while walking1 == true do
  169. for i = 1,5 do
  170. wait()
  171. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,0.4)
  172. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,0.4)
  173. end
  174. for i = 1,5 do
  175. wait()
  176. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.4)
  177. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.4)
  178. end
  179. end
  180. end
  181. end
  182. end
  183. mouse.KeyDown:connect(walk1)
  184. function notwalk1(key)
  185. key = key:lower()
  186. if key == "d" then
  187. walking1 = false
  188. run.Volume = 0
  189. for i = 1,10 do
  190. wait()
  191. rig["Left Hip"].C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  192. rig["Right Hip"].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  193. end
  194. end
  195. end
  196. mouse.KeyUp:connect(notwalk1)
  197. ------------------------------------------
  198. walking2 = false
  199. function walk2(key)
  200. key = key:lower()
  201. if key == "a" then
  202. walking2 = true
  203. run.Volume = 10
  204. if walking2 == true then
  205. wait()
  206. for i = 1,5 do
  207. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.2)
  208. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.2)
  209. end
  210. while walking2 == true do
  211. for i = 1,5 do
  212. wait()
  213. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,0.4)
  214. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,0.4)
  215. end
  216. for i = 1,5 do
  217. wait()
  218. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.4)
  219. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.4)
  220. end
  221. end
  222. end
  223. end
  224. end
  225. mouse.KeyDown:connect(walk2)
  226. function notwalk2(key)
  227. key = key:lower()
  228. if key == "a" then
  229. walking2 = false
  230. run.Volume = 0
  231. for i = 1,10 do
  232. wait()
  233. rig["Left Hip"].C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  234. rig["Right Hip"].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  235. end
  236. end
  237. end
  238. mouse.KeyUp:connect(notwalk2)
  239. ----------------------------------------------------
  240. walking3 = false
  241. function walk3(key)
  242. key = key:lower()
  243. if key == "s" then
  244. walking3 = true
  245. run.Volume = 10
  246. if walking3 == true then
  247. wait()
  248. for i = 1,5 do
  249. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.2)
  250. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.2)
  251. end
  252. while walking3 == true do
  253. for i = 1,5 do
  254. wait()
  255. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,0.4)
  256. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,0.4)
  257. end
  258. for i = 1,5 do
  259. wait()
  260. rig["Left Hip"].C0 = rig["Left Hip"].C0 * CFrame.Angles(0,0,-0.4)
  261. rig["Right Hip"].C0 = rig["Right Hip"].C0 * CFrame.Angles(0,0,-0.4)
  262. end
  263. end
  264. end
  265. end
  266. end
  267. mouse.KeyDown:connect(walk3)
  268. function notwalk3(key)
  269. key = key:lower()
  270. if key == "s" then
  271. walking3 = false
  272. run.Volume = 0
  273. for i = 1,10 do
  274. wait()
  275. rig["Left Hip"].C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  276. rig["Right Hip"].C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  277. end
  278. end
  279. end
  280. mouse.KeyUp:connect(notwalk3)
  281. grabbing = true
  282. function grab1(cart1)
  283. if grabbing == true then
  284. local torso = cart1.Parent:findFirstChild("Torso")
  285. if torso ~= nil then
  286. local hum = cart1.Parent:findFirstChild("Humanoid")
  287. if hum ~= nil then
  288. hum.PlatformStand = true
  289. local weld1 = Instance.new("Weld", torso)
  290. weld1.Part0 = torso
  291. weld1.Part1 = cart
  292. weld1.C0 = weld1.C0 * CFrame.Angles(-8,0,1.2) * CFrame.new(0,-1.4,0)
  293. end
  294. end
  295. end
  296. end
  297. cart.Touched:connect(grab1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement