How would i make it so that the frames that i turned false and true in the script stay like that upon rejoining ```MarketplaceService = game:GetService(“MarketplaceService”)
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local DevProductID = 2690116131 – Replace with your actual Developer Product ID
local giveTokensEvent = ReplicatedStorage:WaitForChild(“GiveTokensEvent”)
– Reference the button and its parent frame
local button = script.Parent
local buttonFrame = button.Parent – The parent of the button (the frame that contains the button)
local scrollingFrame = buttonFrame.Parent – The parent of the buttonFrame (the scrolling frame)
local offerFrameClone = scrollingFrame:WaitForChild(“Offer1FrameClone”) – The frame to be shown after purchase
local TokenAmount = 2000000
– Hide the offer frame clone initially (in case it is visible by default)
offerFrameClone.Visible = false
– Function to handle the button click
button.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer – Get the local player
if player then
– Trigger the purchase when the button is clicked
MarketplaceService:PromptProductPurchase(player, DevProductID)
else
warn(“LocalPlayer not found!”)
end
end)
– Listen for purchase completion
MarketplaceService.PromptProductPurchaseFinished:Connect(function(player, productId, wasPurchased)
if wasPurchased and productId == DevProductID then
– Hide the current frame (the parent of the button)
giveTokensEvent:FireServer(TokenAmount)
buttonFrame.Visible = false
-- Make the new frame (Offer1FrameClone) visible and ensure it stays visible
offerFrameClone.Visible = true
-- Disable this frame from ever becoming visible again
end
end)```