Switch team gamepass and a gamepass button text button opener text button exit Made with Clipchamp

preview_player
Показать описание
Script 1 frame open
local button = script.Parent
local frame = button.Parent:WaitForChild("Frame")

frame.Visible = false

button.MouseButton1Click:Connect(function()
frame.Visible = true
end)

Script 2 Frame closes
local button = script.Parent
local frame = button.Parent:WaitForChild("Frame")

frame.Visible = true

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

Script 3 Gamepass button
local button = script.Parent
local player = game.Players.LocalPlayer
local gamePassID = 12345678 -- Replace with your actual GamePass ID

button.MouseButton1Click:Connect(function()
local hasPass = false

-- Checking if the player owns the GamePass
local success, result = pcall(function()
return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamePassID)
end)

if success then
hasPass = result
else
warn("There was an error checking the GamePass ownership.")
end

if hasPass then
print("Player owns the GamePass.")
-- Do something if the player owns the GamePass
else
print("Player does not own the GamePass.")
-- Prompt the player to purchase the GamePass
game:GetService("MarketplaceService"):PromptGamePassPurchase(player, gamePassID)
end
end)

Script 4 Gamepass switch team

local button = script.Parent
local player = game.Players.LocalPlayer
local gamePassID = 12345678 -- Replace with your actual GamePass ID
local targetTeamName = "New Team" -- Replace with your target team's name

button.MouseButton1Click:Connect(function()
local hasPass = false

-- Checking if the player owns the GamePass
local success, result = pcall(function()
return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamePassID)
end)

if success then
hasPass = result
else
warn("There was an error checking the GamePass ownership.")
end

if hasPass then
print("Player owns the GamePass.")
-- Switch the player's team if they own the GamePass
local teams = game:GetService("Teams")
local targetTeam = teams:FindFirstChild(targetTeamName)
if targetTeam then
player.Team = targetTeam
print("Switched to team: " .. targetTeamName)
else
warn("Target team not found.")
end
else
print("Player does not own the GamePass.")
-- Prompt the player to purchase the GamePass
game:GetService("MarketplaceService"):PromptGamePassPurchase(player, gamePassID)
end
end)
Рекомендации по теме