Hi there! So my question is, is it possible to make the spawner only spawn a car by a specefic user id ?
local inUse = false
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local gamePassID = 5896143
local player = game.Players.LocalPlayer
script.Parent.Button.ClickDetector.MouseClick:connect(function(player)
wait(0.1)
local hasPass = false
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.userId, gamePassID)
end)
wait(0.1)
if not success then
warn("Error: " .. tostring(message))
return
end
wait(0.1)
if hasPass == false then
game:GetService("MarketplaceService"):PromptGamePassPurchase(player, gamePassID)
end
if hasPass == true then
if inUse == false and not game.Workspace:FindFirstChild("car"..player.Name.."1") then
if player:GetRankInGroup(0) >= 0 then
inUse = true
script.Parent.Button.BrickColor = BrickColor.new("Really black")
local a = game.ServerStorage:FindFirstChild(script.Parent.CarName.Value)
if a ~= nil then
local b = a:Clone()
b.Parent = game.Workspace
b.Name = "car"..player.Name.."1"
end
wait(1)
script.Parent.Button.BrickColor = BrickColor.new("Navy blue")
inUse = false
end
end
end
end)
Thanks! :D
