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

Ideas for my error with this "Decal Importer"?

Asked by 8 years ago
local Decal = game.Workspace["PBST New Decal Projector (without script)"].Display.Decal
local Button = script.Parent.TextButton
local Box = script.Parent.TextBox
local Label = script.Parent.Label
local ID = script.Parent.ID

Button.MouseButton1Click:connect(function()
    script.Parent.ID.Value = script.Parent.ID.Value - 1
    Decal.Texture = "http://www.roblox.com/asset/?id=" ..ID.Value.. ""
end)

Box.InputBegan:connect(function()
    while wait() do
        Label.Text = "ID: " ..Box.Text.. ""
        ID.Value = Box.Text
    end
end)

What this is, is a "Decal Importer Script". It is commonly used at HQ for places. I have all the hereditary correct, but I get this error when in "Play Mode". Note not ROBLOX Studio Play Mode, but the ROBLOX Client Play Mode.

ERROR: "TextButton" isn't a valid member of Frame. script:Line 2

2 answers

Log in to vote
1
Answered by 8 years ago

Sometimes things load a little bit after people spawn in, nibzor. So we can fix this by using Waitforchild so it waits for each of the locals.

local Decal = game.Workspace["PBST New Decal Projector (without script)"].Display.Decal
local Button = script.Parent:WaitForChild("TextButton")
local Box = script.Parent:WaitForChild("TextBox")
local Label = script.Parent:WaiForChild("Label")
local ID = script.Parent.ID

Button.MouseButton1Click:connect(function()
    script.Parent.ID.Value = script.Parent.ID.Value - 1
    Decal.Texture = "http://www.roblox.com/asset/?id=" ..ID.Value.. ""
end)

Box.InputBegan:connect(function()
    while wait() do
        Label.Text = "ID: " ..Box.Text.. ""
        ID.Value = Box.Text
    end

end)

Ad
Log in to vote
0
Answered by 8 years ago

The reason the output says that is because you must make sure that the TextButton's parent is the Frame.

Answer this question