Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't this work in Server but it does in Studio? Confused.

Asked by 6 years ago

I'm making this tip box where you click the box and a GUI appears to select the type of tip. I've done that part (it works). But when I scripted Marketplace it doesn't work in Server but does in Studio. I'm confused. And it's in a LocalScript if it helps to figuring this out.

local id1 = 342011634 
local id2 = 342011882 --Developer Product IDs
local id3 = 342023684

script.Parent.smol.MouseButton1Click:Connect(function()
    game.MarketplaceService:PromptProductPurchase(script.Parent.Parent.Parent, id1)
end)

script.Parent.grande.MouseButton1Click:Connect(function()
    game.MarketplaceService:PromptProductPurchase(script.Parent.Parent.Parent, id2)
end)

script.Parent.venti.MouseButton1Click:Connect(function()
    game.MarketplaceService:PromptProductPurchase(script.Parent.Parent.Parent, id3)
end)

1 answer

Log in to vote
0
Answered by 6 years ago

Make the scripts localscript.

local Player = game:GetService("Players").LocalPlayer

local id1 = 342011634 
local id2 = 342011882
local id3 = 342023684

script.Parent.smol.MouseButton1Click:Connect(function()
    game.MarketplaceService:PromptProductPurchase(Player.UserId, id1)
end)

script.Parent.grande.MouseButton1Click:Connect(function()
    game.MarketplaceService:PromptProductPurchase(Player.UserId, id2)
end)

script.Parent.venti.MouseButton1Click:Connect(function()
    game.MarketplaceService:PromptProductPurchase(Player.UserId, id3)
end)
Ad

Answer this question