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

What is wrong with this script (part 2)?

Asked by 9 years ago

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?

local Id = "ASSET NUMBER HERE"

script.Parent.TextButton.MouseButton1Click:connect(function(player) --Changed ClickDetector to TextButton
    game:GetService("MarketplaceService"):PromptPurchase(player, Id)
end)

0
Check the output. Any errors? EzraNehemiah_TF2 3552 — 9y
0
Check line one: The identifier 'Id' is set to '"ASSET NUMBER HERE"', when 'PromptPurchase' is calling 'Id', as a 'Number', but returns a string instead. TheeDeathCaster 2368 — 9y
0
I put the ID in and it still won't work. And the error is this: 20:37:44.358 - TextButton is not a valid member of TextButton 20:37:44.360 - Script 'Workspace.Part.SurfaceGui.T-Shirt.Script', Line 3 20:37:44.361 - Stack End User#5689 -1 — 9y
0
'TextButton' may not be existant within 'SurfaceGui', judging by your error, is 'T-Shirt' the TextButton? TheeDeathCaster 2368 — 9y
View all comments (8 more)
0
Yes User#5689 -1 — 9y
0
Then 'T-Shirt' may not be existant at the time when the code executes, try using the 'WaitForChild' method? TheeDeathCaster 2368 — 9y
0
How do you do that? Plus even if I did that I am not sure if that is going to work User#5689 -1 — 9y
0
The 'WaitForChild' method waits for the Child, and will return it when it is existant [Parent:WaitForChild(Child)], also, you never know until you try! :D TheeDeathCaster 2368 — 9y
0
Where would I put this though? User#5689 -1 — 9y
0
Where would I put the 'WaitForChild' in? I am actually learning them for the first time (kinda) User#5689 -1 — 9y
0
Wait, can you give us the ID for the TShirt? EzraNehemiah_TF2 3552 — 9y
0
148438289 User#5689 -1 — 9y

Answer this question