The error given is: Workspace.REventHandler:3: attempt to index local 'item' (a nil value)
Local Script which defines item "selectedItem's value is set to 1 and there is always a child in foundation"
local items = game.Lighting.items:WaitForChild("foundation"):GetChildren() local item = items[stat:WaitForChild("selectedItem").Value]:Clone() mouse.Button1Down:connect(function() if stat.isValid.Value == true then evt.build:FireServer(item:GetPrimaryPartCFrame(), items[stat.selectedItem.Value]:Clone()) end end)
game.ReplicatedStorage.REvents.build.OnServerEvent:connect(function(plr, cframe, item) item:SetPrimaryPartCFrame(cframe) item.Parent = workspace.targetFilter.building end)