I want this script to work on TextButton where you click the button instead of using a part with ClickDetector. Can you please change it to TextButton that can work? This is the same script I asked before but with TextButton to it:
local Id = "ASSET NUMBER HERE" script.Parent.TextButton.MouseClick:connect(function(player) --Changed ClickDetector to TextButton game:GetService("MarketplaceService"):PromptPurchase(player, Id) end)
local Id = "ASSET NUMBER HERE" script.Parent.TextButton.MouseButton1Click:connect(function(player) --Changed ClickDetector to TextButton game:GetService("MarketplaceService"):PromptPurchase(player, Id) end)
Try this because MouseClick
isn't a proper event for TextButton. Try MouseButtonDown1Click
instead. MouseButton1 means the button on the left of your mouse and Click is click so you "Left Click". You can also use MouseButtonDown2Click
so they would have to right click it! You could also use MouseWheelForward
so they would have to scroll up on the screen gui instead of clicking on it. Or you could use MouseWheelBackwards
is scrolling down.
SHORTENED VERSION
Basicly just use MouseButtonDown1Click
instead of MouseClick
when you are using text or Image buttons in Gui's.
You have to be specific with scripts. A ClickDetector
is obviously the asset in the part to make the function happen. This is built in with a TextButton
and so the 'asset' in the TextButton
is Button.
Learn from these scripts and constantly go back to others that you or someone else has made to gather an idea.
local Id = "ASSET NUMBER HERE" script.Parent.TextButton.MouseButton1Click:connect(function(player) --Changed ClickDetector to TextButton game:GetService("MarketplaceService"):PromptPurchase(player, Id) end)