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

How do make this script into TextButton and not ClickDetector?

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)


7 comments

0

I was kinda mad how you accepted the other guy's answer instead of mine because I gave a thorough explanation so you actually LEARN how to script instead of relying on Free Models or the website or asking other people for answers. Also, use MouseButtonDown1Click instead of MouseClick when you are using text or Image buttons in Gui's because ClickDetectors have different events. Imma little inraged

0

I meant to accept the other guys answer, but not this one. I am glad you are explaining them to me. TheAlphaStigma you helped me alot to

0

No problem, that's what we're here for. :)

0

TheAlphaStigma. I haven't got a reply from you when I PM'ed you on your alternate account.

0

AlphaStigma is either cloning himself or is always on scripting helpers when I'm on... Creepy! Jk he is good at scripting and helped me too.

0

TheAlphaStigma is just an account for Scripting Helpers, because at the time my Main, TheeDeathCaster, had a max of 5-10 groups, so I created TheAlphaStigma for that purpose. :P

0

TheAlphaStigma please answer my other question, it is the same but it is not working for what LordDragonZord asked. You can look at your alt account for my PM

2 answers

✓ Accepted answer
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.

1 comment

0

Thank you for this explanation for my script. I am sorry about that. I meant to accept the other message I had before for my Music Script. Thank you soo much bro.

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)



10 comments

0

Or just explain it to him instead of him having to go back to this script everytime he tries to make a script with a text button.

0

No what I am saying is for him to go back to scripts when he gets stuck.

0

Thank you. And sorry for being dumb on it.

0

In case you didn't know you also have to explain your answers like how I did. I only disliked because it didn't have a good explanation.

0

kie, do you know what an asset it? It's a basic object that uses a event called MouseClick. I gave a more thorough explanation.

0

Please provide some kind of explanation behind your answer, just adding 'use MouseButton1Click instead of MouseClick' does not give a full explanation on why he should use it. Why should he use it? What does the 'MouseButton1Click' event do? How to use the 'MouseButton1Click'? What is it called on? I am not trying to be rude, but, please provide some kind of explanation, for, if you don't, it does

0

*it does not help the user to understand the reason behind your answer.

0

So, I should have gave more explanation

0

I'm not talking about you, Ben, I was talking to Kier.

0

I tried the script out, but it is still not working for some reason. The reason why I asked this question was that I wanted to change the text button in TMM Credit Vendor to a shirt, t-shirt, etc vendor. And what it has in the workspace is Part,Surface GUI, and then with text buttons. What should I do then?

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