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

How do I whitelist my friend on my gamepasss script?

Asked by
Lakodex 711 Moderation Voter
4 years ago

So. I am kinda making a kind of fnaf game. I've attempted this before it has not even worked with Names / ID's, Please fix. Its HardMode BTW

local debounce = false
local Clicked = false
local MarketplaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local hasPass = false

local Bypassed = {
    "Panda_Scopez12";
}

gamePassID = 7415466

script.Parent.MouseButton1Click:Connect(function()
    hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
    if Bypassed == player.Name then
        wait(0.2)
        hasPass = true
    end
    if hasPass == true and debounce == false and Clicked == false then
        debounce = true
        Clicked = true
        script.Parent.Text = "Hard Mode: On"
        script.Parent.Parent.Parent.HardMode.Value = true
    wait(0.5)
    debounce = false
    elseif hasPass == true and debounce == false and Clicked == true then
        debounce = true
        Clicked = false
        script.Parent.Text = "Hard Mode: Off"
        script.Parent.Parent.Parent.HardMode.Value = false      
    elseif hasPass == false and debounce == false then
        MarketplaceService:PromptGamePassPurchase(player, gamePassID)
        script.Parent.Text = "ACCESS DENIED"
        wait(1)
        script.Parent.Text = "Hard Mode: Off"
        script.Parent.Parent.Parent.HardMode.Value = false
    wait(0.5)
    debounce = false        
    end
end)

1 answer

Log in to vote
1
Answered by 4 years ago

You are attempting to compare a table value with a string value, do this

local debounce = false
local Clicked = false
local MarketplaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local hasPass = false

local Bypassed = {
    "Panda_Scopez12";
}

gamePassID = 7415466

script.Parent.MouseButton1Click:Connect(function()
    hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
   for i,v in pairs(Bypassed) do
if v == player.Name then
hasPass = true
break

end
end
    if hasPass == true and debounce == false and Clicked == false then
        debounce = true
        Clicked = true
        script.Parent.Text = "Hard Mode: On"
        script.Parent.Parent.Parent.HardMode.Value = true
    wait(0.5)
    debounce = false
    elseif hasPass == true and debounce == false and Clicked == true then
        debounce = true
        Clicked = false
        script.Parent.Text = "Hard Mode: Off"
        script.Parent.Parent.Parent.HardMode.Value = false      
    elseif hasPass == false and debounce == false then
        MarketplaceService:PromptGamePassPurchase(player, gamePassID)
        script.Parent.Text = "ACCESS DENIED"
        wait(1)
        script.Parent.Text = "Hard Mode: Off"
        script.Parent.Parent.Parent.HardMode.Value = false
    wait(0.5)
    debounce = false        
    end
end)

If this helped mark this as the answer :D

0
darn was just about to make a answer BashGuy10 384 — 4y
0
Thanks man. Works like I wanted it to. Lakodex 711 — 4y
Ad

Answer this question