so im making a shop and 'attempt to index nil with 'name'' keeps coming up
here is my code
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local remoteEvent = ReplicatedStorage:WaitForChild('BuyTool')
local function buyTool(player, tool)
local giveTool = ReplicatedStorage.ShopItems[tool.name]:Clone()
giveTool.Parent = player.Backpack
local giveTool = ReplicatedStorage.ShopItems[tool.name]:Clone()
giveTool.Parent = player.StarterGear
end
remoteEvent.OnServerEvent:Connect(buyTool)

1 comment
From the error, I can tell that tool has a nil value. Can you edit your auestion and add the script that fires, this serverevent?