How Can I make script understand which wall player tries to buy

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want to destroy the wall the player is trying to remove after player clicks “Yes” Button

  1. What is the issue? Include screenshots / videos if possible!

I am not sure how to make script understand which wall player tries to remove

I can make something like yesButton.Activated > Wall1.Destroy()
but I don’t want to do it that way because there are many walls and other stuff.
How Can I make script understand which wall player tries to buy

the Gui pop ups after Triggering ProximetryPrompt

I don’t know if any script sharing required for this question but maybe?

local module = {
	["FirstDoor"] = {Name = "FirstDoor", Price = 300, RequiredZoneLevel = 0},
	["SecondDoor"] = {Name = "SecondDoor", Price = 500, RequiredZoneLevel = 1},
	["ThirdDoor"] = {Name = "ThirdDoor", Price = 800, RequiredZoneLevel = 2},

return module

you can detect the walls name, use attributs, use objectvalues, use stringvalues, use variables, use arguments, a lot of stuff really (if i understand your post, then this is prolly what ur looking for)

Can you quickly give example?
if you are trying to say something like
Use a value and then remove walls depends on it like
if Value = 1 then remove Wall1
if Value = 2 then remove Wall2
then if there is like 10 walls Then it will take so much line

for example, when you buy a wall, you loop through the module script you have to find that wall, and then do stuff

YEAH and question is how to Look for Wall named Wall1 when player Clicks to yes button
and not Other walls
OR how to look for Wall 2 next time player clicks to yes button

for example
create a remote event btw

--local script
local remote = game.ReplicatedStorage.RemoteEvent
local yesbutton = script.Parent -- path to the Yes button


local remote = game.ReplicatedStorage.RemoteEvent
local module = require(idk where your module script is)

remote.OnServerEvent:Connect(function(player, wall)
	for i, v in pairs(module) do
		if table.find(i, wall) then
			player.leaderstats.Cash.Value -= v.Price

this code is VERY rushed and not the best, but i think you can improve it to fit your liking

so. I am asking again How server will know WHICH Wall I am trying to remove. THE code just sends The wall Named “Wall” What if I want to remove Wall2 After Wall1
this is just for removing ONE wall. doesn’t depends on the one I Choose