So, I need an event to trigger whenever someone clicks on a button to buy an item. But, for some reason, the event isn't working! Help me please.
script that triggers the event:
Price = 3
Item = "Burger"
be = game.workspace.Homes.Buy
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
local Cash = player.leaderstats.Gold
if Cash.Value >= Price then
Cash.Value = Cash.Value - Price
be:Fire(Item, player)
end
end)
script that holds the event:
RS = game:GetService("ReplicatedStorage")
local function onEvent(Item, player)
print("the event fires at least...")
local item = RS.Item
local itemC = item:Clone()
itemC.Parent = player.Backpack
print("WE DID IT!")
end
be = game.Workspace.Homes.Buy
be.Event:Connect(onEvent)

2 comments
I should considered to make a shop since shop questions get questioned alot.
I was using a bindable event before haha. Thanks for that!