this is my script in serverscriptservice
local RepSto = game:GetService("ReplicatedStorage")
local CraftTool = RepSto:WaitForChild("CraftTool")
local toolFolder = RepSto:WaitForChild("Toolls")
local craftingData = require(RepSto:WaitForChild("CraftingToolsData"))
CraftTool.OnServerInvoke = function(player, toolName)
local inventory = player:WaitForChild("Inventory")
local Stick = inventory:FindFirstChild("Stick")
local Stone = inventory:FindFirstChild("Stone")
local IronIngot = inventory:FindFirstChild("IronIngot")
local crafted = false
for i, v in pairs(craftingData[toolName]) do
local material = inventory:FindFirstChild(i)
if material then
if material.Value >= v then
material.Value = material.Value - v
crafted = true
else
crafted = false
end
end
end
if crafted == true then
local tool = toolFolder:FindFirstChild(toolName):Clone()
if tool then
tool.Parent = player.Backpack
end
end
end
and this is local script in gui
local RepSto = game:GetService("ReplicatedStorage")
local CraftTool = RepSto:WaitForChild("CraftTool")
local craftingframe = script.Parent
craftingframe.StonePickaxe.MouseButton1Click:Connect(function()
for i, button in pairs(craftingframe:GetChildren()) do
if button:IsA("TextButton") then
button.MouseButton1Click:Connect(function()
CraftTool:InvokeServer(button.Name)
end)
end
end
end)

3 comments
maybe you should remake the code to see if you have any erros
Is there any errors in the output? You can activate the output by going to: View>Output located at the topbar in studio.
no errors in output