UsernameRTX

Driving Simulator Wrap Changer (Client)

May 1st, 2021
944
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local RunService = game:GetService("RunService")
  2. local MarketplaceService = game:GetService("MarketplaceService")
  3. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  4.  
  5. local Library = loadstring(game:GetObjects("rbxassetid://4133667265")[1].Source)("Library by wally")
  6. local CreateWindow = Library:CreateWindow(MarketplaceService:GetProductInfo(game.PlaceId).Name)
  7.  
  8. local player = require(ReplicatedStorage.kernel.globals.shared.client.player)
  9. local ColorCodec = require(ReplicatedStorage.src.lib.codec.ColorCodec)
  10. local CarTracker = require(ReplicatedStorage.src.pcar.CarTracker)
  11. local Applicator = require(ReplicatedStorage.src.upgrades.Wrap.Applicator)
  12. local WrapManager = require(ReplicatedStorage.src.upgrades.Wrap.WrapManager)
  13.  
  14. local ApplicateWrap = function()
  15.     Applicator(CarTracker.getCarFromDriver(player), nil, {
  16.         shared.Name,
  17.         shared.ColourNumber,
  18.         shared.Opacity,
  19.         shared.Speed
  20.     })
  21. end
  22.  
  23. local CanApplicateWrap = function()
  24.     if shared.Name and shared.ColourNumber and shared.Opacity and shared.Speed then
  25.         return true
  26.     else
  27.         return false
  28.     end
  29. end
  30.  
  31. local Section = CreateWindow:Section("Wrap Changer (Client)")
  32.  
  33. local Dropdown = CreateWindow:Dropdown("Wraps", {
  34.     location = shared,
  35.     flag = "Name",
  36.     list = WrapManager.getWrapIds()
  37. }, function(...)
  38.     if CanApplicateWrap() then
  39.         ApplicateWrap()
  40.     end
  41. end)
  42.  
  43. local Box = CreateWindow:Box("Colour Number", {
  44.     flag = "ColourNumber",
  45.     type = "number"
  46. }, function(Box, New, Old, Enter)
  47.     shared.ColourNumber = tonumber(New)
  48.     if CanApplicateWrap() then
  49.         ApplicateWrap()
  50.     end
  51. end)
  52.  
  53. local Slider = CreateWindow:Slider("Opacity", {
  54.     precise = true,
  55.     min = 0,
  56.     max = 1,
  57.     flag = "Opacity"
  58. }, function(Number)
  59.     shared.Opacity = tonumber(Number)
  60.     if CanApplicateWrap() then
  61.         ApplicateWrap()
  62.     end
  63. end)
  64.  
  65. local Slider2 = CreateWindow:Slider("Speed", {
  66.     min = -100,
  67.     max = 100,
  68.     flag = "Speed"
  69. }, function(Number)
  70.     shared.Speed = tonumber(Number)
  71.     if CanApplicateWrap() then
  72.         ApplicateWrap()
  73.     end
  74. end)
  75.  
  76. local Toggle = CreateWindow:Toggle("Rainbow", {
  77.     flag = "Rainbow",
  78.     location = getfenv()
  79. }, function(...)
  80.     shared.Rainbow = Rainbow
  81. end)
  82.  
  83. local Frequency = 1
  84. local AngularFrequency = 2 * math.pi * Frequency / 256
  85. local Phase = math.rad(0)
  86.  
  87. RunService.RenderStepped:Connect(function()
  88.     if shared.Rainbow then
  89.         shared.ColourNumber = tonumber(ColorCodec.colorToNumber(Color3.fromHSV(math.abs(math.sin(AngularFrequency * tick() + Phase)), 1, 1)))
  90.         if CanApplicateWrap() then
  91.             ApplicateWrap()
  92.         end
  93.     end
  94. end)
RAW Paste Data