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

Why won't my script insert new frames for each new tool I put in?

Asked by 4 years ago
Edited 4 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

So bassically I wrote out a script that would make it so any new tool that I wanted in my gui would show as a frame on my GUI everytime I put in a new tool. But for some reason the script looks correct but no new frames are showing up on my GUI, can someone please help me out? I'm seeing no errors in my output.


Heres the script:

local folder = game.ReplicatedStorage:WaitForChild("Tools")

local frame = script.Parent:WaitForChild("Frame")

local template = frame:WaitForChild("Template")

for _, tool in pairs(folder:GetChildren()) do
    local newTemplate = template:Clone()
    newTemplate.Name = tool.Name
    newTemplate.ObjectName.Text = tool.Name
    newTemplate.Visible = true
    newTemplate.Parent = frame
    --Tool in the VPF

    --Event for when you click it 
    newTemplate.MouseButton1Click:Connect (function()
        local result = game.ReplicatedStorage.BuyItem:InvokeServer(tool.Name)

        if result == true then
            -- We know it was a success
        else
            -- We know it went wrong
        end
    end)
end
0
Where's line 41? That's where the error's occuring Pupppy44 671 — 4y
0
im not sure, i dont have any scripts that are all the way down at line 41 LostedMxnd 2 — 4y
0
I dont think that error had anything to do with the script I put. It was just from some random part from a model I had. LostedMxnd 2 — 4y

Answer this question