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

making a confirm purchase GUI?

Asked by 5 years ago

so i made this buyable house, wich works fine, but i want it so when the player clicks the door a GUI pops up saying like "are you sure you want to buy this house?" and i have a "no" button, but i don't know how to make the yes button work, so whenever you press the yes button, the menu dissapears and the home is yours.

the script that is inside the yes button, the yes button is inside a frame, frame inside a screenGUI and the ScreenGUI inside a Door part.

houseprice = script.Parent.Parent.Parent.Parent:WaitForChild("Price")
currentowner = script.Parent.Parent.Parent.Parent:WaitForChild("CurrentOwner")
script.Parent.ClickDetector.MouseClick:Connect(function(player)
    if player:FindFirstChild("leaderstats") and player.Name ~= currentowner.Value and currentowner.Value == "" then
        -- we know that the player has leaderstats
        if player.leaderstats.Cash.Value >= houseprice.Value then
            script.Parent.Parent.Name = player.Name.."'s House"
            player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - houseprice.Value
            script.Parent.Parent.CurrentOwner.Value = player.Name
        end
    end
end)

1 answer

Log in to vote
-1
Answered by
iuclds 720 Moderation Voter
5 years ago

Make the buy button open another GUI that says "Are you sure?" Then when you click that button it automatically buys

0
wich buy button do you mean? at the moment you click the door, and then the menu pops up with the yes adndthe no buttons. blokskesman -8 — 5y
Ad

Answer this question