Its simple, try to use location:WaitForChild("Object_Name")
Here is a example:
local plr = game.Players.LocalPlayer
plr:WaitForChild("Backpack")
print("Backpack found!")
local plr = game.Players.LocalPlayer
local backpack = plr:WaitForChild("Backpack")
print("Backpack found!")
backpack:WaitForChild("Any_Item"):Clone()
You can try this:
local plr = game.Players.LocalPlayer
local input = game:GetService("UserInputService")
local remote = game.ReplicatedStorage:WaitForChild("Yami2")
local db = true
local plrgui = plr:WaitForChild("PlayerGui")
local gui = plrgui:WaitForChild("Waitmove")
if gui:WaitForChild("Logia") then
input.InputBegan:Connect(function(key, gameProcessed)
if key.KeyCode == Enum.KeyCode.H and not gameProcessed then
remote:FireServer(db)
wait(2)
db = false
end
end)
end
If the error continues, the gui is not being replicated to the PlayerGui
How WaitForChild works?
Returns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does.
WaitForChild() - Wiki page
Hope it helped :)
Errors? tell-me on comments.
3 comments
Try using Instance:WaitForChild()
you can either add a repeat wait() until plr.PlayerGui.Waitmove or :WaitForChild(), as mentioned ^
repeat wait until is a terrible way to wait for something, and should never be encouraged.