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

ImageButton in a surfacegui script; does nothing; no error?

inside a local script in a image button

local Player = game.Players.LocalPlayer
local ID = 1225234267

script.Parent.MouseButton1Click:connect(function(click)
	game:GetService("MarketplaceService"):PromptPurchase(Player,ID)
end)

the problem is, it does nothing, no error message, nothing. I want it to prompt purchase when a player clicks it, any tips or ideas?

2 answers

✓ Accepted answer

http://wiki.roblox.com/index.php?title=API:Class/SurfaceGui/Adornee

Parent the surfaceGui and all its children in the playergui (or startergui) and set the surfaceGui’s Adornee property to the part.

7 comments

0

What the heck....... this is so irrelevant

0

No, its the answer. Look at the page for adornee, and things have to be in the players gui for it to work with clicks etc

0

Adornee: sets what the surface gui is attached to

0

Mouse input requires the object to be in a client-sided object. Workspace is not client sided, but

0

PlayerGuis is. This is the one reason why the adornee property even exists. You cant get mouse input because the mouse doent exist in the workspace.

0

Works perfectly, thanks!

0

No problemo

I dont know what you did wrong here, your script works fine. I have tested your script. I've also added in the explorer to let you know how the objects are placed.

I hope this helps you, make sure to upvote if it does. Thank you!

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