Basically I was working on a plugin for hours and this error popped up saying "LocalScript.lua:87: attempt to index nil with 'WaitForChild'" I don't really know what I have done wrong but here's the script! Please tell me the problem with my script!
-- Create new 'DockWidgetPluginGuiInfo' object local WidgetInfo = DockWidgetPluginGuiInfo.new( Enum.InitialDockState.Float, -- Widget will be initialized in floating panel true, -- Widget will be initially enabled false, -- Don't override the previous enabled state 500, -- Default width of the floating window 500, -- Default height of the floating window 500, -- Minimum width of the floating window (optional) 500 -- Minimum height of the floating window (optional) ) -- Create new widget GUI local Interface = plugin:CreateDockWidgetPluginGui("CurrencyMaker", WidgetInfo) Interface.Title = "Currency Maker!" local Toolbar = plugin:CreateToolbar("WIP") local Button = Toolbar:CreateButton("WIP","WIP","") Button.Click:Connect(function() Interface.Enabled = not Interface.Enabled end) local Background = Instance.new("Frame",Interface) Background.Size = UDim2.new(1,0,1,0) Background.Position = UDim2.new(0,0,0,0) Background.BackgroundColor3 = Color3.fromRGB(150,150,150) local CreateButton = Instance.new("TextButton",Interface) CreateButton.Position = UDim2.new(0.5,0,0.8,0) CreateButton.AnchorPoint = Vector2.new(0.5,0.5) CreateButton.Size = UDim2.new(0,320,0,84) CreateButton.Style = "RobloxRoundButton" CreateButton.Text = "Create Currency!" CreateButton.Font = Enum.Font.GothamBold CreateButton.TextSize = 35 CreateButton.TextColor3 = Color3.fromRGB(0,0,0,0) local CurrencyName = Instance.new("TextBox",Interface) CurrencyName.Position = UDim2.new(0.5,0,0.2,0) CurrencyName.Size = UDim2.new(0,325,0,90) CurrencyName.AnchorPoint = Vector2.new(0.5,0.5) CurrencyName.TextScaled = true CurrencyName.PlaceholderText = "Currency Name" CurrencyName.Text = "" CurrencyName.PlaceholderColor3 = Color3.fromRGB(100,100,100) CurrencyName.TextColor3 = Color3.fromRGB(0,0,0,0) CurrencyName.Font = Enum.Font.GothamSemibold CurrencyName.BorderSizePixel = 3 CurrencyName.BorderMode = Enum.BorderMode.Outline CurrencyName.BorderColor3 = Color3.fromRGB(55,55,55) local StartingValue = Instance.new("TextBox",Interface) StartingValue.Position = UDim2.new(0.5,0,0.4,0) StartingValue.Size = UDim2.new(0,325,0,90) StartingValue.AnchorPoint = Vector2.new(0.5,0.5) StartingValue.TextScaled = true StartingValue.PlaceholderText = "Starting Value" StartingValue.Text = "" StartingValue.PlaceholderColor3 = Color3.fromRGB(100,100,100) StartingValue.TextColor3 = Color3.fromRGB(0,0,0,0) StartingValue.Font = Enum.Font.GothamSemibold StartingValue.BorderSizePixel = 3 StartingValue.BorderMode = Enum.BorderMode.Outline StartingValue.BorderColor3 = Color3.fromRGB(55,55,55) local AutosavingToggle = Instance.new("TextLabel",Interface) AutosavingToggle.Position = UDim2.new(0.5,-20,0.6,0) AutosavingToggle.Size = UDim2.new(0, 315,0, 25) AutosavingToggle.AnchorPoint = Vector2.new(0.5,0.5) AutosavingToggle.BackgroundTransparency = 1 AutosavingToggle.Text = "Enable Autosaving" AutosavingToggle.Font = Enum.Font.GothamSemibold AutosavingToggle.TextScaled = true local Toggle = Instance.new("TextButton",AutosavingToggle) Toggle.Position = UDim2.new(0.880, 0,0.158, 0) Toggle.Size = UDim2.new(0, 25,0, 25) Toggle.BorderSizePixel = 3 Toggle.BorderMode = Enum.BorderMode.Outline Toggle.BorderColor3 = Color3.fromRGB(49,49,49) Toggle.BackgroundColor3 = Color3.fromRGB(125,125,125) Toggle.Text = "" local AutosavingEnabled = false CreateButton.MouseButton1Click:Connect(function() if AutosavingEnabled == true then local WithSave = script.Parent.CurrencyWithAutoSave WithSave:Clone() WithSave.Disabled = false WithSave.Parent = game.ServerScriptService else local WithoutSave = script.Parent.CurrencyWithoutAutoSave WithoutSave:Clone() WithoutSave.Disabled = false WithoutSave.Parent = game.ServerScriptService end end) StartingValue:GetPropertyChangedSignal("Text"):Connect(function() if tonumber(StartingValue.Text) or StartingValue.Text == "" then StartingValue.Text = StartingValue.Text else print("The amount you've entered isn't a number or it simply the amount you've entered is sort of malformed. Please make sure the amount only contains numbers!") end end)
Also, I coded this using a local script so yeah