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
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)