Need help adding a certain player only function to an existing script

Hey all, I am currently working on a game and I am using a vehicle spawner for my personal vehicles. The script however has no section to add a certain player, therefor anybody can use the spawner. What code should I use to add a certain player only function? The script is below.

clickDetector = Instance.new(“ClickDetector”)

function click(Player)
if not Player.PlayerGui:FindFirstChild(“Gui”) then
local gui = script.Parent.ScreenGui:Clone()
gui.Parent = Player.PlayerGui
end
end

clickDetector.Parent = script.Parent

clickDetector.MouseClick:connect(click)

Store the player in a variable, then do if player == allowedplayer then

You can also do the same via usernames by checking their .Name property.

If you just want to be able to use it you could use an if statment when the clickdetector is clicked/activated and if the player who clicked it equals to u then run it.

Basically the same thing like @Qariter Said. If you want more then one person to be able to use them you can use the above but add the player usernames or ID’s to a table and loop through the table to check if they can use it or not (if they can then/got there name the vehical can spawn in)

Im kind of a noob when it comes to this. Can you add it to the script I pasted? I’m easily confused by this haha.

Add it within your other If then statements.