Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Prompting Developer Product Problems. ??????

Local Script (Ignore the part at the top):

local player = game:GetService("Players").LocalPlayer
local PlayerGui = player.PlayerGui

while true do
	Money = player:WaitForChild("leaderstats").Money.Value
	PlayerGui.ScreenGui.MoneyLabel.Text = "Money: " .. Money
	Gems = player:WaitForChild("leaderstats").Gems.Value
	PlayerGui.ScreenGui.GemsLabel.Text = "Gems: " .. Gems
	wait(.1)
end


function onClicked()
game.ReplicatedStorage.RemoteEvent:FireServer(player)
end

script.Parent.ShopButton.Activated:Connect(onClicked)

Normal Script (Ignore the part at the top):

local function onPlayerJoin(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
 
	local Money = Instance.new("IntValue")
	Money.Name = "Money"
	Money.Value = 0
	Money.Parent = leaderstats
	
	
	local Gems = Instance.new("IntValue")
	Gems.Name = "Gems"
	Gems.Value = 0
	Gems.Parent = leaderstats
end
 
game.Players.PlayerAdded:Connect(onPlayerJoin)


local MarketplaceService = game:GetService("MarketplaceService")
local productID = 453120071

function OnServerEvent(plr)
	MarketplaceService:PromptProductPurchase(plr, productID)
end

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(OnServerEvent)

3 comments

0

Does not prompt.

0

maybe edit your last question instead of making a new question

0

Instead of having a while loop to change the display, use a changed event.

1 answer

✓ Accepted answer

The onClicked function you made will never be registered because the while true do loop you made prevents the code from reaching it. You can move the onClicked function AND the script.Parent.ShopButton.Activated:Connect(onClicked) before the loop so that it will register.

This discussion is preserved as it was. New answers, comments, and votes are closed.