Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do I alter this script to make it so only one car is allowed per person and it deletes others ? [closed]

Asked by 3 years ago
Edited 3 years ago

Im making a car spawner gui which ive got working fine but ive been trying to come up with a script that allows only one car per person so that it deletes the other cars they've previously spawned in and replaces it with the new one etc, can anyone help?

this is my script so far and its stored in a text box

script.Parent.MouseButton1Click:connect(function(GetCar) Mod = game.ServerStorage.VWPASSATESTATECIV clone = Mod:clone() clone.Parent = workspace clone:MakeJoints() end)

thanks

Closed as Not Constructive by Leamir

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 3 years ago

so basically you keep a dictionary with entries as userId of that player and default value of nil when a player spawns a car u check this value if its nil then just assing the reference of the car to that entry next time when the player spawns the car u check that entry again and if its not nill u destroy the previous car by using that reference and create a new car and store the reference in that entry again

Ad