When a brick is clicked in my game, it fires a remote event, and an item is added to the players inventory (the inventory is a custom one I made). Here's the script in the brick:
function onClick(plr) script.Parent:Destroy() local event = Instance.new("RemoteEvent") event.Parent = plr.Backpack event.Name = "TestShroomAdd" event:FireClient(plr) print("!") end script.Parent.ClickDetector.MouseClick:connect(onClick)
and here's the script in the players Backpack:
local event = script.Parent.Parent:WaitForChild("TestShroomAdd") event.OnClientEvent:connect(function() print("!") if game.Players.LocalPlayer.PlayerGui.Inventory.Frame.slotone.Value ~= true then game.Players.LocalPlayer.PlayerGui.Inventory.Frame.slot_one.Object.Value = "testshroom" game.Players.LocalPlayer.PlayerGui.Inventory.Frame.slot_one.Text = "TestShroom" game.Players.LocalPlayer.PlayerGui.Inventory.Frame.slotone.Value = true elseif game.Players.LocalPlayer.PlayerGui.Inventory.Frame.slottwo.Value ~= true then game.Players.LocalPlayer.PlayerGui.Inventory.Frame.slot_two.Object.Value = "testshroom" game.Players.LocalPlayer.PlayerGui.Inventory.Frame.slot_two.Text = "TestShroom" game.Players.LocalPlayer.PlayerGui.Inventory.Frame.slottwo.Value = true end end)
Note: script in the backpack is a Local Script.
now, the problem. If there are two bricks, and I click on each of them, the Remote Event only fires once. Each brick is exactly the same, same script (the first script I mentioned), same everything, however the first brick I click on fires the event, and it gets added to the players inventory, however the second brick I click does fire the event (as far as I know), however the script in the players backpack does not react to the event being fired. Any help?