Advertisement
Guest User

LT2 Pink Car Spawner

a guest
Oct 25th, 2019
2,552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.18 KB | None | 0 0
  1. if _G.Executed == false or _G.Executed == nil then
  2. _G.Executed = true
  3. Spawned = false
  4. Spawning = false
  5. SpawnPad = nil
  6. workspace.PlayerModels.ChildAdded:connect(function(Added)
  7.     if Spawned == false and Spawning == false then
  8.         Owner = nil
  9.         CheckTries = 0
  10.         CheckSuccess = false
  11.         repeat
  12.         wait()
  13.         CheckTries = CheckTries + 1
  14.         if Added:FindFirstChild("Owner") and Added:FindFirstChild("Type") and Added.Type.Value == "Vehicle" and Added:FindFirstChild("Settings") and Added.Settings:FindFirstChild("Color") then
  15.             CheckSuccess = true
  16.             Owner = Added.Owner.Value
  17.         end
  18.         until CheckTries == 75 or CheckSuccess == true
  19.         if Owner == game.Players.LocalPlayer or game.ReplicatedStorage.Interaction.ClientIsWhitelisted:InvokeServer(Owner) == true then
  20.                 Spawning = true
  21.                 Added:WaitForChild("Settings")
  22.                 Added.Settings:WaitForChild("Color")
  23.                 print(tostring(Added.Settings.Color.Value))
  24.                 if tostring(Added.Settings.Color.Value) == tostring(1032) then
  25.                     Spawned = true
  26.                     Spawning = false
  27.                     print(Spawned)
  28.                 elseif tostring(Added.Settings.Color.Value) ~= tostring(1032) then
  29.                     if SpawnPad:FindFirstChild("ButtonRemote_SpawnButton") and SpawnPad:FindFirstChild("Owner") then
  30.                         if SpawnPad.Owner.Value == game.Players.LocalPlayer or game.ReplicatedStorage.Interaction.ClientIsWhitelisted:InvokeServer(SpawnPad.Owner.Value) == true then
  31.                             Spawning = false
  32.                             warn(game.ReplicatedStorage.Interaction.RemoteProxy:FireServer(SpawnPad.ButtonRemote_SpawnButton))
  33.                             Spawning = false
  34.                     end
  35.                 end
  36.             end
  37.         end
  38.     end
  39. end)
  40.  
  41. mouse = game.Players.LocalPlayer:GetMouse()
  42. mouse.KeyDown:connect(function(key)
  43.     if key:lower() == "c" then
  44.         if mouse.Target.Parent:FindFirstChild("ButtonRemote_SpawnButton") then
  45.             SpawnPad = mouse.Target.Parent
  46.             Spawned = false
  47.             Spawning = false
  48.             game.ReplicatedStorage.Interaction.RemoteProxy:FireServer(mouse.Target.Parent.ButtonRemote_SpawnButton)
  49.         else
  50.             Spawned = true
  51.             Spawning = false
  52.         end
  53.     end
  54. end)
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement