Город МОСКОВСКИЙ
00:04:10

How To Make A Gamepass Button In Roblox Studio 2023

Аватар
Игры и Виртуальное Обучение
Просмотры:
101
Дата загрузки:
30.10.2023 06:32
Длительность:
00:04:10
Категория:
Лайфстайл

Описание

Script:
local MS = game:GetService("MarketplaceService")
local Gamepass = 172773740-- The ID of the Gamepass.
local OpenTrans = 1 -- The transparency of the button when it is bought.
local BuyGUI = true -- Set to false to stop the BuyGUI appearing.

-----------------------------------------------------------------------------------------------

local Button = script.Parent -- Button

-----------------------------------------------------------------------------------------------



Button.Touched:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if Gamepass = 0 then return nil end
if MS:UserOwnsGamePassAsync(plr.UserId, Gamepass) then
Button.CanCollide, Button.Transparency = false, OpenTrans
else
if BuyGUI == true then
MS:PromptGamePassPurchase(plr, Gamepass)
end
end
end
end)

Рекомендуемые видео