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

How do make this script into TextButton and not ClickDetector?

Asked by 9 years ago

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)


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 EzraNehemiah_TF2 3552 — 9y
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 User#5689 -1 — 9y
0
No problem, that's what we're here for. :) TheeDeathCaster 2368 — 9y
0
TheAlphaStigma. I haven't got a reply from you when I PM'ed you on your alternate account. User#5689 -1 — 9y
View all comments (3 more)
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. EzraNehemiah_TF2 3552 — 9y
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 TheeDeathCaster 2368 — 9y
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 User#5689 -1 — 9y

2 answers

Log in to vote
2
Answered by 9 years ago
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.

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. User#5689 -1 — 9y
Ad
Log in to vote
-1
Answered by 9 years ago

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)



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. EzraNehemiah_TF2 3552 — 9y
0
No what I am saying is for him to go back to scripts when he gets stuck. kieranm9090 49 — 9y
0
Thank you. And sorry for being dumb on it. User#5689 -1 — 9y
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. EzraNehemiah_TF2 3552 — 9y
View all comments (6 more)
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. EzraNehemiah_TF2 3552 — 9y
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 TheeDeathCaster 2368 — 9y
0
*it does not help the user to understand the reason behind your answer. TheeDeathCaster 2368 — 9y
0
So, I should have gave more explanation User#5689 -1 — 9y
0
I'm not talking about you, Ben, I was talking to Kier. TheeDeathCaster 2368 — 9y
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? User#5689 -1 — 9y

Answer this question