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

How do I make a clickable sign?

So I am trying to make an object that can be clicked, and when clicked it will prompt the player to buy a gamepass. I have the script inside a ClickDetecter which is inside the object. Here is what I tried but it didn't work.

local player = game.Players.LocalPlayer
local id = 573965111
script.Parent.Clicker.ClickDetector.MouseClick:connect(function()
	game:GetService("MarketplaceService"):PromptPurchase(player, id)
end)

If anyone could tell me what I am doing wrong or how to fix it I would be very grateful.

Thanks in advanced!

11 comments

0

If you're trying to make it a surface gui you need to put the GUI in StarterGui and set the Adornee property to the part with which you want the gui to be on.

0

I don't understand what you mean, if you're talking about the button that can be displayed on your screen that's not what I mean, I mean to be able to click an object.

0

You're gonna have to use a surfacegui since the Clicker object is in the workspace and clickdetectors can't tell you who clicked it. If you don't want to do that then I guess you could use local parts, but I doubt you're ready for that.

0

Okay thanks!

0

I tried that V

0

That's is wrong Meltdown81. ClickDetectors will provide you the player who clicked the part, regardless now if FilteringEnabled is turned on or not. The Event will provide the player as an argument to the function to be utilized at the developer's discretion.

0

Is this a server script or local script? Is it in Workspace or somewhere in player? https://scriptinghelpers.org/blog/common-mistakes

0

It's in a workspace.

0

Is it a ServerScript or LocalScript?

0

Ahh Server script, yeah, yeah, serverscript.

0

Don't Worry Guys! I Figured it out!

2 answers

✓ Accepted answer

**In Server Script: **

Note: Make sure 'Clicker' is the part so we can click this part. Make sure to insert a ClickDetector in the part 'Clicker'.

local id = 573965111
script.Parent.Clicker.ClickDetector.MouseClick:connect(function(player)
    game:GetService("MarketplaceService"):PromptPurchase(player, id)
end)

4 comments

0

This didn't work

0

Try printing something in the function.

0

There was a couple other problems due to following others instructions, that I figured out myself, but yours was the one that answered it, so thanks!

0

Np

I tried put a SurfaceGui in the StarterGui then inserted this script into the SurfaceGui:

local player = game.Players.LocalPlayer
local id = 573965111
script.Parent.Clicker.SurfaceGui.MouseClick:connect(function()
	game:GetService("MarketplaceService"):PromptPurchase(player, id)
end)

and I set the Adornee to the object.

It didn't work so I tried inserting a Clicker to the object and that didn't work, so... What am I doing wrong?

2 comments

0

You con't click a SurfaceGui, you can click a TextButton in one though.

0

FiredDusk that didn't work

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