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

Is it possible to make this car spawner script only work for user id ?

Asked by 4 years ago

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

1 answer

Log in to vote
0
Answered by 4 years ago

I'm not sure how you're going to do it. But this way you can check what the person that triggers the script id is and then do something

game.Players.PLAYERNAME.CharacterAppearanceId

Ad

Answer this question