#give gamepass

1 messages · Page 1 of 1 (latest)

sturdy lynx
#

Help me

#

GUI localscript
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")

local GiftFrame = script.Parent
local plrList = GiftFrame.PlayerList
local sample = plrList:WaitForChild("PlayerTemplate")
local searchBox = GiftFrame.SearchBox
local button = GiftFrame.Close
local UIListLayout = plrList:FindFirstChildOfClass("UIListLayout")

local GiftVIPEvent = ReplicatedStorage:WaitForChild("GiftVIP")
local PRODUCT_ID = 3389040782

button.MouseButton1Click:Connect(function()
GiftFrame.Visible = false
end)

local function clearList()
for _, item in pairs(plrList:GetChildren()) do
if item:IsA("TextButton") and item ~= sample then
item:Destroy()
end
end
end

#

local function fillList(filter)
filter = filter and filter:lower() or ""
clearList()

for _, plr in pairs(Players:GetPlayers()) do
    if plr ~= player and plr.Name:lower():find(filter) then
        local btn = sample:Clone()
        btn.Name = plr.Name
        btn.Text = plr.Name
        btn.Visible = true
        btn.Parent = plrList

        if plr:FindFirstChild("VIP") then
            btn.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
        else
            btn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
        end

        btn.MouseButton1Click:Connect(function()
            GiftVIPEvent:FireServer(plr.UserId)

            MarketplaceService:PromptProductPurchase(player, PRODUCT_ID)
        end)
    end
end

if UIListLayout then
    plrList.CanvasSize = UDim2.new(0,0,0,UIListLayout.AbsoluteContentSize.Y + 5)
end

end

searchBox:GetPropertyChangedSignal("Text"):Connect(function()
fillList(searchBox.Text)
end)

fillList("")

Players.PlayerAdded:Connect(function() fillList(searchBox.Text) end)
Players.PlayerRemoving:Connect(function() fillList(searchBox.Text) end)

#

ServerScriptService>GiftVIP
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DataStoreService = game:GetService("DataStoreService")
local RunService = game:GetService("RunService")

local GiftVIPEvent = Instance.new("RemoteEvent")
GiftVIPEvent.Name = "GiftVIP"
GiftVIPEvent.Parent = ReplicatedStorage

local VIPBought = Instance.new("RemoteEvent")
VIPBought.Name = "VIPBought"
VIPBought.Parent = ReplicatedStorage

local VIPData = DataStoreService:GetDataStore("VIPData")

local VIP_PRODUCT_ID = 3389040782
local pendingGifts = {}

local function giveVIP(targetPlayer)
if not targetPlayer then
return
end

if not targetPlayer:FindFirstChild("VIP") then
    local bool = Instance.new("BoolValue")
    bool.Name = "VIP"
    bool.Value = true
    bool.Parent = targetPlayer
end

local success, err = pcall(function()
    VIPData:SetAsync(tostring(targetPlayer.UserId), true)
end)
if success then
end

end

Players.PlayerAdded:Connect(function(player)
local success, data = pcall(function()
return VIPData:GetAsync(tostring(player.UserId))
end)
if success then
if data then
if not player:FindFirstChild("VIP") then
local bool = Instance.new("BoolValue")
bool.Name = "VIP"
bool.Value = true
bool.Parent = player
end
end
end
end)

exotic inletBOT
#

studio** You are now Level 3! **studio

sturdy lynx
#

GiftVIPEvent.OnServerEvent:Connect(function(sender, targetUserId)
pendingGifts[sender.UserId] = targetUserId

if RunService:IsStudio() then
    local targetPlayer = Players:GetPlayerByUserId(targetUserId)
    if targetPlayer then
        giveVIP(targetPlayer)
        VIPBought:FireAllClients(sender.Name, targetPlayer.Name)
    end
end

end)

MarketplaceService.ProcessReceipt = function(receiptInfo)

if receiptInfo.ProductId == VIP_PRODUCT_ID then
    local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
    if player then
        local targetUserId = pendingGifts[player.UserId]
        if targetUserId then
            local targetPlayer = Players:GetPlayerByUserId(targetUserId)
            if targetPlayer then
                giveVIP(targetPlayer)
                VIPBought:FireAllClients(player.Name, targetPlayer.Name)
            end
            pendingGifts[player.UserId] = nil
        end

        return Enum.ProductPurchaseDecision.PurchaseGranted
    end
end

return Enum.ProductPurchaseDecision.NotProcessedYet

end

ivory saddle
#

wheres the issue