been trying to figure it out for a while, i know what im trying to do but i just dont know how to get it. its a crafting script where it figures out the price of the item and then will craft it.
please help if you can :)
script.Parent.MouseButton1Click:Connect(function(player) for _, kids in pairs(script.Parent.Parent.recipe:GetChildren()) do if kids.ClassName == ("IntValue") then local item = kids.Name local price = kids.Value -- heres where im lost local items = game.Players.LocalPlayer.PlayerGui.ScreenGui.inv.ImageLabel.Frame:GetChildren() local num = #items print (num) if num >= price then --haven't finished this part yet game.ReplicatedStorage.crafting.sendoff:FireServer(item, price) end end end end)
(Edited the answer) So you want to remove e.g the woods from the table? example:
local stuff = workspace.Folder:GetChildren() for i,v in pairs (stuff) do if v.Name ~= "wood" then -- if object's name is not wood table.remove(stuff, i) --Removing object from table end end
You have to detect if there is an object called wood in a table, and if yes, then remove it.