I’m making a donation GUI and for some wierd reason this is not working can someone please explain what’s happening.
Here is the explorer:
Here is the board:
Here is the script:
I’m making a donation GUI and for some wierd reason this is not working can someone please explain what’s happening.
Here is the explorer:
Here is the board:
Here is the script:
On the line:
Button = script.Parent.TenDo
The LocalScript’s parent is TenDo
however you’re trying to index script.Parent.TenDo
, consider just making it script.Parent
parent your surfaceGui to starterGui and set the adornee to the part you wanted
Note : TextButton(buttonGui) / Textbox only work when the surfaceGui / BillboardGui is under starterGui
You could use an alternative that could be this:
–//Donation Button
local DONATIONBUTTON = script.Parent
local ITEM_ID = 0 -- Developer Product
local Click = Instance.new("ClickDetector",DONATIONBUTTON)
Click.MouseClick:connect(function(p)
game:GetService("MarketplaceService"):PromptProductPurchase(p,ITEM_ID)
end)
You cannot access the LocalPlayer from workspace. You have to place the SurfaceGui into StarterGui and set the adornee
property to the part the billboard should be on.
Also, to organize your workflow you should have one script for all the buttons. For example:
local TenButton = Path.To.Button
local TwentyButton = Path.To.Button
local function PromptPurchase()
end
TenButton.MouseButton1Click:Connect(PromptPurchase)
Do you mean ScreenGui? I’m sure that’s a surfaceGui
Instead of billboard guis and all , simply use a click detector , insert it in the part you want to prompt a purchase when clicked on
use these scripts, everything works and is tested.
Script called Gui:
function click(Player)
if not Player.PlayerGui:FindFirstChild("Gui") then
local gui = script.Gui:clone()
gui.Parent = Player.PlayerGui
gui.LocalScript.Disabled = false
end
end
script.Parent.ClickDetector.MouseClick:connect(click)
Script called “Local Script”
button = script.Parent
window = button.Parent
function onClicked(GUI)
window:remove()
end
script.Parent.MouseButton1Click:connect(onClicked)
Script called Gamepass ID
local id = 6298177 -- YOUR OWN GAMEPASS ID HERE, If you dont have one then create it first and use the id
script.Parent.ClickDetector.MouseClick:connect(function(player)
game:GetService("MarketplaceService"):PromptPurchase(player, id)
end)
Script called Clicker :
for i,v in pairs(script.Parent.Buttons:GetChildren()) do
v.MouseButton1Down:connect(function()
if v:FindFirstChild("Gamepass") ~= nil then
game:GetService("MarketplaceService"):PromptPurchase(game.Players.LocalPlayer, tonumber(v.Name))
else
game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, tonumber(v.Name))
end
end)
end
This should work unless you’ve done something wrong.