Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Ideas for my error with this "Decal Importer"?

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

✓ Accepted answer

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)

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

This discussion is preserved as it was. New answers, comments, and votes are closed.