Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

HELP! My crafting gui won't work?

Asked by 8 years ago

This is on a local script

I tested the script and when I tried to craft, It worked...... but it didn't give me what I crafted.

Please help me!

---- Load Stuff ----

local us = game:GetService("UserInputService")
local crafts = game.ServerStorage:WaitForChild("Craft")
local p = game.Players.LocalPlayer

print('Loaded stuff! O3O')

---- Crafting ----

function Add(o)
    game.Players.LocalPlayer.PlayerGui.GUIC.Craft.Craft.Text = game.Players.LocalPlayer.PlayerGui.GUIC.Craft.Craft.Text .. o.Name .. ", "
    o:remove()
end

function sel(obj)
    if obj.Locked ~= true then
        Add(obj)
    end
end

local m = game.Players.LocalPlayer:GetMouse()

m.Button1Down:connect(function()
    if m.Target ~= nil then
    sel(m.Target)
    end
end)

m.KeyDown:connect(function(key)
    if key == "f" then
        for _,c in pairs(crafts:GetChildren()) do
            if c:FindFirstChild("Recipe").Value == p.PlayerGui.GUIC.Craft.Craft.Text then
                if c.ClassName == "Tool" then
                    c:Clone().Parent = p.Backpack
                    p.PlayerGui.GUIC.Craft.Craft.Text = ""
                    return
                else
                    for _,cc in pairs(c:GetChildren()) do
                        if cc.ClassName == "HopperBin" then
                            cc:Clone().Parent = p.Backpack
                            p.PlayerGui.GUIC.Craft.Craft.Text = ""
                            return
                        end
                    end
                end
            else
                p.PlayerGui.GUIC.Craft.Craft.Text = ""
                return
            end

        end
    end
end)

---- Inventory ----


Update: Checking the Recipe values didn't work. They are all perfect but it's still not working. I recorded a video of the error. Take a look

Update: I'm going insane with my game broken. I'm starting to consider quitting on making a survival game. I'd make another game based on a game I played in 5th grade ._.

0
What is this used for? Like the game? Just wondering. looks interesting because most games avoid crafting. DeveloperSolo 370 — 8y
0
@JohnTUnderwood I am using this for a survival game (similar to survival 404) creeper1164 17 — 8y
0
Oh, cool. DeveloperSolo 370 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

the code looks good, check the game.ServerStorage.Craft folder and verify that all resipies are not empty strings "" and that what you are trying to make is typed correctly. Add print statements to print the gui label and compare side by side with the target resipie to ensure not a single capital or space is out of place.

0
I tried this but my recipe's are perfect. Got any other suggestions? creeper1164 17 — 8y
Ad

Answer this question