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

Why won't this car script work?

Asked by 10 years ago

I tried to make it so if a user has a gamepass, it clone's the gui and change's the parent to the player, it prompt's the user to purchase the gamepass, even if they have it. Can someone tell me what I did wrong?

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)


0
Can you explain your code? This doesn't seem to make any sense. What is the purpose of the different variable? BlueTaslem 18071 — 10y
0
To be honest, I don't know. spacek531 made it, I just tried to edit it and make it work with a gamepass. InfinitivePixelsJr 542 — 10y

Answer this question