Hello,
I recently created a Stone Positioning Plugin from a kit I made using CFrame, Inspired in Eppobot’s plugin. I am having a serious problems with CoreGui:WaitForChild("Plugin_Gui"). It seems to me that there is some delay for the GUI to appear on CoreGui, but :WaitForChild() should take care of it, I believe. Edit: The plugin keeps working, I just wanted to know how to remove this annoying error.
The problem.

I tried to solve this by adding a wait time for CoreGui:WaitForChild("Plugin_Gui", x), and sometimes it worked and sometimes it didn’t.
The script.
--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_ START _--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_
local plugin = PluginManager():CreatePlugin()
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local gui = script.Parent.RockPlacerGui
local active = false
local version = '1.0'
--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_
-- Check if user has loaded plugin before
local hasLoaded = plugin:GetSetting("pluginHasLoaded")
if not hasLoaded then
plugin:SetSetting("pluginHasLoaded", true)
end
--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_
-- Setup Toolbar
local toolbar = plugin:CreateToolbar("Streeteenk")
--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_
-- Setup button
local button = toolbar:CreateButton(
"Rock Placer",
"",
"rbxassetid://3458763977"
)
button.Click:connect(function()
active = not active
if active then
gui.Parent = game:GetService("CoreGui")
plugin:Activate(true)
button:SetActive(true)
else
gui.Parent = script.Parent
button:SetActive(false)
end
end)
--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_
-- Flat and Smooth button functions
local rocktype = true
repeat wait() until game.CoreGui:WaitForChild("RockPlacerGui")
game.CoreGui:WaitForChild("RockPlacerGui").Frame.Flat.MouseButton1Click:Connect(function()
game.CoreGui.RockPlacerGui.Frame.Flat.Text = "X"
game.CoreGui.RockPlacerGui.Frame.Smooth.Text = ""
rocktype = true
end)
game.CoreGui:WaitForChild("RockPlacerGui").Frame.Smooth.MouseButton1Click:Connect(function()
game.CoreGui.RockPlacerGui.Frame.Flat.Text = ""
game.CoreGui.RockPlacerGui.Frame.Smooth.Text = "X"
rocktype = false
end)
--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_
-- Binds function to left click
local mouse = plugin:GetMouse() -- Mouse detection
mouse.Button1Down:connect(function()
local fold = game.Workspace:FindFirstChild("PluginRocks") or Instance.new('Folder',game.Workspace)
fold.Name = "PluginRocks"
if rocktype == true then
local flattb = script.FlatRocks:GetChildren()
local r = flattb[math.random(1,#flattb)]:Clone()
r.Parent = fold
local sz = math.random(game.CoreGui.RockPlacerGui.Frame.MinSize.Text, game.CoreGui.RockPlacerGui.Frame.MaxSize.Text)
r.Rock.Size = Vector3.new(sz,sz,sz)
r:SetPrimaryPartCFrame(mouse.Hit * CFrame.new( 0, game.CoreGui.RockPlacerGui.Frame.RockPos.Text, 0) * CFrame.Angles(math.random(), math.random(), math.random() ))
ChangeHistoryService:SetWaypoint("Rock Added")
end
if rocktype == false then
local smoothtb = script.SmoothRocks:GetChildren()
local r = smoothtb[math.random(1,#smoothtb)]:Clone()
r.Parent = fold
local sz = math.random(game.CoreGui.RockPlacerGui.Frame.MinSize.Text, game.CoreGui.RockPlacerGui.Frame.MaxSize.Text)
r.Rock.Size = Vector3.new(sz,sz,sz)
r:SetPrimaryPartCFrame(mouse.Hit * CFrame.new( 0, game.CoreGui.RockPlacerGui.Frame.RockPos.Text, 0) * CFrame.Angles(math.random(), math.random(), math.random() ))
ChangeHistoryService:SetWaypoint("Rock Added")
end
end)
--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_
game.CoreGui:WaitForChild("RockPlacerGui",45).Credits.Version.Text = "Current Version: " .. version
--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_ END _--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_
Insert in your command bar: “game:GetService("InsertService"):LoadAsset(3458787882,true).Parent = game.Workspace” or Install.