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

How do I get this SurfaceGUI Button to work?

Asked by
Ulysies 50
9 years ago

Im trying to make a surfaceGUI shop.. and this isnt working... can someone help?

local assetId = 223132588 --Insert any object Id

local player = script.Parent.Parent.Parent.Parent
while not player:IsA("Player") do player = player.Parent end 

script.Parent.TextButton.MouseButton1Down:connect(function()
game:GetService("MarketplaceService"):PromptPurchase(player, assetId)
end)
0
You can't grab the player like that. The highest order in the hierarchy you'd get would be 'game'. Is this SurfaceGui inside either 'StarterPack' or 'StarterGui'? If not, I'd recommend you put it there and set its 'Adornee' to the actual part in Workspace. Then you could use 'LocalPlayer' with a localscript. DigitalVeer 1473 — 9y
0
If this is a localscript, just use game.Players.LocalPlayer to get a reference to the player object. Merely 2122 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

usually changing this to a script might help... or u might have to define the function on line 6

Ad

Answer this question