Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local model = game.Workspace.Car --or whatever the path to the model of your car is
- local playerValue = game.Workspace.Car.StringValue
- local deleteButton = game.Workspace.Car.DeleteButton
- local button = script.Parent --or whatever the path to your button is
- local destination = Vector3.new(x, y, z) --the 3D coordinates of where you'd like the car to spawn
- local function spawnCar(Clicker)
- model:MoveTo(destination) --use this if you want to move the car that's in the dealership
- model:Clone():MoveTo(destination) --use this if you want to make a copy of the car and move that
- playerValue.Value = Clicker.Name -- sets the person who clicked's name to the value.
- end
- local function deleteCar(Clicker)
- if playerValue.Value == Click.Name then -- if the players name is the same as the owner's name
- model:Destroy() -- destroy the car if it is
- end
- end
- button.MouseClick:Connect(spawnCar) --notice it's "spawnCar", NOT "spawnCar()"
- deleteButton.MouseClick:Connect(deleteCar) -- notice it's "deleteCar", NOT "deleteCar()"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement