Advertisement
pa1nx9

Retail Tycoon 2 COLLECT BOUGHT GOODS

Nov 12th, 2021
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None
  1. local Client = game:GetService("Players").LocalPlayer
  2. local GetPlot = function() return getrenv()._G.Plot end
  3. local GetLoadingDock = function()
  4. local Plot = tostring(GetPlot())
  5. local DockNum = string.gsub(Plot, "Plot_", "")
  6. return game:GetService("Workspace").Map.Landmarks["Loading Dock"]["LoadingDock_" .. DockNum].LoadingSpot
  7. end
  8.  
  9. local GetVehicle; GetVehicle = function()
  10. for _, v in next, workspace.PlayerVehicles:GetChildren() do
  11. if v.Name:match(Client.Name) then
  12. return v
  13. end
  14. end
  15. game:GetService("ReplicatedStorage").Remotes.SpawnVehicle:InvokeServer(1, Client.Character.HumanoidRootPart.CFrame * CFrame.new(10, 5, 0))
  16. task.wait()
  17. return GetVehicle()
  18. end
  19.  
  20. local LoadCar = function()
  21. local Vehicle = GetVehicle()
  22. Vehicle:SetPrimaryPartCFrame(GetLoadingDock().CFrame)
  23. Client.Character:SetPrimaryPartCFrame(Vehicle.PrimaryPart.CFrame * CFrame.new(5, 0, 0))
  24. task.wait(.5)
  25. game:GetService("ReplicatedStorage").Remotes.LoadVehicle:InvokeServer()
  26. end
  27.  
  28. local UnloadCar = function()
  29. for i, v in next, GetPlot():GetDescendants() do
  30. if v.Name:lower():match("door") then
  31. if v:FindFirstChild("Handle") and v:FindFirstChild("Base") then
  32. local Vehicle = GetVehicle()
  33. Vehicle:SetPrimaryPartCFrame(CFrame.new(v.Base.Position + Vector3.new(10, 6, 10)))
  34. Client.Character:SetPrimaryPartCFrame(Vehicle.PrimaryPart.CFrame * CFrame.new(5, 0, 0))
  35. task.wait(.5)
  36. game:GetService("ReplicatedStorage").Remotes.UnloadVehicle:InvokeServer()
  37. end
  38. end
  39. end
  40. end
  41.  
  42. local GetBoughtStuff = function()
  43. LoadCar()
  44. task.wait()
  45. UnloadCar()
  46. end
  47.  
  48. GetBoughtStuff()
Advertisement
RAW Paste Data Copied
Advertisement