Can 1 script detect when multiple GUIs are clicked and refer to that GUI too

I want to fix my inventory system and make 1 script control all of the drop and place buttons rather than having 1 script per button.


I want to make “Empty Script” able to detect when “Drop” or “Place” are clicked and open “Stats” to read the information for every frame.

I`ve tried to use GetDescendants() with MouseButton1Down function but I cant figure out how to make it read the stats folder. Is there any way to do this or should I not be using this method at all?

This is the drop script:

Part = script.Parent.Parent.Stats.Item.Value
script.Parent.MouseButton1Click:Connect(function()

local NewPart = workspace.Parent.ReplicatedStorage.DropItems[Part]:Clone()
local Player = script.Parent.Parent.Parent.Parent.Parent.Parent
local character = Player.Character
local Yax = character.PrimaryPart.Position.Y

NewPart.Parent = workspace
NewPart.PrimaryPart.CFrame = CFrame.new(NewPart.PrimaryPart.Position, character.PrimaryPart.Position)
NewPart.PrimaryPart.CFrame = character.PrimaryPart.CFrame:ToWorldSpace(CFrame.new(0,0,-5))
Player.Inventory[Part].Value = Player.Inventory[Part].Value - 1

end)

The place button just makes a ghost block and opens a yes and no GUI.

Use for i,v in pairs to make it read the stats folder