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

Car Script Not Letting User Enter?

Asked by 10 years ago

The car script prompt's the user to buy the gamepass, but if the user own's the gamepass, it won't let the user use the car still. Output show's no error. Can anyone tell me what is wrong with it?

gamepass = 174856301
Check = {}



wait(0.1)
Blacklist = {}
GroupID = 0
seat = script.Parent
cur = nil
script.Parent.ChildAdded:connect(function(it)
        if it:IsA("Weld") then
        tempcur = it.Part1.Parent
        if cur ~= tempcur and cur ~= nil then tempcur.Humanoid.Sit = false return end
        if cur == tempcur then print("same guy!")return end
        print(tempcur.Name)
        done = false
        cur = tempcur
        local Player = game.Players:GetPlayerFromCharacter(cur)
        for _,i in pairs (Check) do
            if i == game:GetService("MarketplaceService"):PlayerOwnsAsset(Player,gamepass) then
                done = true
                if Player.PlayerGui:findFirstChild("Car") then
                    done = false
                end
            end
        end
        for _,i in pairs (Blacklist) do
            if cur.Name == i then
                done = false
            end
        end
        if done == false then
            game:GetService("MarketplaceService"):PromptPurchase(Player,gamepass)
            cur.Humanoid.Sit = false
            cur = nil
            Player = nil
            print(tempcur.Name.." was booted")
            script.Parent.Parent.Parent = workspace
        else
            script.Car:Clone().Parent = Player.PlayerGui
            game.Players:GetPlayerFromCharacter(cur).PlayerGui.Car.Frame.Seat.Value = script.Parent
            game.Players:GetPlayerFromCharacter(cur).PlayerGui.Car.Frame.LocalScript.Disabled = false
            script.Parent.Parent.Parent = cur
            end
    elseif it:IsA("IntValue") then
        print("Bye Bye user!")
        cur = nil
        Player = nil
        script.Parent.Parent.Parent = workspace
    end
end)

Answer this question