Advertisement
Guest User

Roblox Car Spawner LocalScript

a guest
Aug 15th, 2015
4,007
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. --- Made by Scootakip
  2. --- Put this in a localscript inside of the TextButton which should be inside of a ScreenGui inside of StarterGui
  3.  
  4. local button = script.Parent
  5. local car = game.Lighting.Car
  6. local player = game.Players.LocalPlayer.Character
  7. local cars = game.Players.LocalPlayer.leaderstats.Car
  8. button.Text = "Get Car"
  9.  
  10.  
  11. function GetCar()
  12.     if cars.Value == 0 then
  13.     button.Text = "Remove Car"
  14.     a = car:clone()
  15.     a.Parent = game.Workspace
  16.     a:MakeJoints()
  17.     a:MoveTo(player.Torso.Position + Vector3.new(0,0,10))
  18.     cars.Value = 1
  19.     elseif cars.Value == 1 then
  20.         button.Text = "Get Car"
  21.         a:Destroy()
  22.         cars.Value = 0
  23.         end
  24. end
  25.  
  26. script.Parent.MouseButton1Click:connect(GetCar)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement