Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.