🔥 How To Make a Gamepass Button That Gives You a Magic Carpet Tool in Roblox Studio 2026! 🪄

Опубликовано: 10 Июль 2026
на канале: BloxMastery Dev
175
7

Learn how to create a Gamepass Button that gives players a Magic Carpet Tool instantly after purchase in Roblox Studio 2026! In this step-by-step tutorial, I'll show you how to set up the gamepass, create the purchase button, write the scripts, and automatically give the Magic Carpet tool to players when they buy the gamepass.

This tutorial is beginner-friendly and perfect for Roblox developers who want to add premium tools, VIP items, and gamepass rewards to their games.

✅ Create a Gamepass
✅ Make a Purchase Button GUI
✅ Give a Magic Carpet Tool
✅ Roblox Studio 2026 Tutorial
✅ Easy Lua Scripting Guide

Local Script 1️⃣

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local button = script.Parent
local gamePassId = button.Parent:WaitForChild("PassID").Value

button.Activated:Connect(function()
MarketplaceService:PromptGamePassPurchase(player, gamePassId)
end)



Server Script

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local tool = script:WaitForChild("Rainbow")
local gamePassId = script:WaitForChild("PassID").Value

local owners = {}
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, purchased)
if purchased and passId == gamePassId then
local coil = tool:Clone()
coil.Parent = player.Backpack
owners["ID_" .. player.UserId] = true
end
end)

Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
wait()

local ownsPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassId)

if ownsPass or owners["ID_" .. player.UserId] then
local coil = tool:Clone()
coil.Parent = player.Backpack
end
end)
end)


If this video helped you, make sure to Like 👍, Subscribe 🔔, and Comment your next tutorial idea!

#Roblox #RobloxStudio #MagicCarpet #Gamepass #RobloxScripting #Lua #RobloxDev #RobloxTutorial #GamepassButton #ToolScript #RobloxDevelopment #Roblox2026 #BloxMastery #Robux #gamingtutorial
------------------------------------------------------------------------------------------------------------------------------------------------------------------

00:00 intro
0:11 setting up GUI and button
3:50 creating gamepass
5:57 testing