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

How do I make a clickable sign?

Asked by 7 years ago
Edited 7 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

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!

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. MrLonely1221 701 — 7y
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. Pot8o_Penguin 50 — 7y
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. Meltdown81 309 — 7y
0
Okay thanks! Pot8o_Penguin 50 — 7y
View all comments (7 more)
0
I tried that V Pot8o_Penguin 50 — 7y
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. M39a9am3R 3210 — 7y
0
Is this a server script or local script? Is it in Workspace or somewhere in player? https://scriptinghelpers.org/blog/common-mistakes M39a9am3R 3210 — 7y
0
It's in a workspace. Pot8o_Penguin 50 — 7y
0
Is it a ServerScript or LocalScript? M39a9am3R 3210 — 7y
0
Ahh Server script, yeah, yeah, serverscript. Pot8o_Penguin 50 — 7y
0
Don't Worry Guys! I Figured it out! Pot8o_Penguin 50 — 7y

2 answers

Log in to vote
0
Answered by
FiredDusk 1466 Moderation Voter
7 years ago

**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)
0
This didn't work Pot8o_Penguin 50 — 7y
0
Try printing something in the function. FiredDusk 1466 — 7y
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! Pot8o_Penguin 50 — 7y
0
Np FiredDusk 1466 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

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?

0
You con't click a SurfaceGui, you can click a TextButton in one though. FiredDusk 1466 — 7y
0
FiredDusk that didn't work Pot8o_Penguin 50 — 7y

Answer this question