Idk what exactly is happening, but either the remote event wont fire or the server isn't detecting when its fired
Client
local MPS = game:GetService("MarketplaceService")
local RS = game:GetService("ReplicatedStorage")
local event = RS:WaitForChild("BoughtItem")
local player = game:GetService("Players").LocalPlayer
for i, button in ipairs(script.Parent:GetChildren()) do
if button:IsA("TextButton") then
button.MouseButton1Click:Connect(function()
if button:FindFirstChild("PurchaseID") then
MPS:PromptProductPurchase(player,button.PurchaseID.Value)
MPS.PromptProductPurchaseFinished:Connect(function(playerID, productID, purchased)
if purchased then
event:FireServer(button.Name)
end
end)
end
end)
end
end
Server
local RS = game:GetService("ReplicatedStorage")
local event = RS:FindFirstChild("BoughtItem")
event.OnServerEvent:Connect(function(player, itemName)
local tool = game.ServerStorage.Assets:FindFirstChild(itemName):Clone()
tool.Parent = player.Backpack
end)