So I have this bindable function:
AddGridItemBF.OnInvoke = function(plr,SizeX,SizeY,Image, itemFrame)
local chr = plr.Character or plr.CharacterAdded:Wait()
local config = Instance.new("Configuration")
config.Name = SizeX.."x"..SizeY
local InvPosX = Instance.new("IntValue")
InvPosX.Name = "InvPosX"
InvPosX.Value = 0
InvPosX.Parent = config
local InvPosY = Instance.new("IntValue")
InvPosY.Name = "InvPosY"
InvPosY.Value = 0
InvPosY.Parent = config
local InvSizeX = Instance.new("IntValue")
InvSizeX.Name = "InvSizeX"
InvSizeX.Value = SizeX
InvSizeX.Parent = config
local InvSizeY = Instance.new("IntValue")
InvSizeY.Name = "InvSizeY"
InvSizeY.Value = SizeY
InvSizeY.Parent = config
local ImageVal = Instance.new("StringValue")
ImageVal.Name = "Image"
ImageVal.Value = Image
ImageVal.Parent = config
config.Parent = replicatedStorage["ItemsInGrid"]
reloadItems()
end
fired from this part of a modulescript: (module is basically an item type that can be placed into the grid)
if Item["IsModule"] then
local Name = Item["Name"]
local Amount = Item["Amount"]
local Image = rbxassetid .. Item["Image"]
local SizeX = Item["SizeX"]
local SizeY = Item["SizeY"]
local EffectFunction = Item["EffectFunction"]
local existingTemplate = scrollingFrame:FindFirstChild(Name)
if existingTemplate then
module.CurrentInvItems[Name]["Amount"] += Amount
itemTemplate:Destroy()
existingTemplate.AmountLabel.Text = "x"..removeLetters(existingTemplate.AmountLabel.Text) + Amount
existingTemplate.ImageButton.MouseButton1Down:Connect(function()
AddGridItemBF:Invoke(plr,SizeX,SizeY,Image,itemTemplate) --or alternatively here
end)
else
module.CurrentInvItems[Name] = Item
itemTemplate.Name = Name
tempImageButton.Image = Image
tempNameLabel.Text = Name
tempAmountLabel.Text = "x"..removeLetters(tempAmountLabel.Text) + Amount
tempImageButton.MouseButton1Down:Connect(function()
AddGridItemBF:Invoke(plr,SizeX,SizeY,Image,itemTemplate) --here
end)
end
end
And whenever any change occurs to the new item that is created after “config” is read to create an item in the grid inventory, I need to also get feedback to the script where its fired from. Ive also posted about aforementioned grid inventory before (the post).
How would I detect that the source of a grid item is this bindable function and get data back to the script it was originally fired from?