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

Waitmove not valid member of PlayerGui when it is? [Solved]

local plr = game.Players.LocalPlayer
local input = game:GetService("UserInputService")
local remote = game.ReplicatedStorage.Yami2
local db = true

if plr.PlayerGui.Waitmove:WaitForChild("Logia") then -- error here
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

waitmove not valid member of playergui when it is hmmm

3 comments

0

Try using Instance:WaitForChild()

0

you can either add a repeat wait() until plr.PlayerGui.Waitmove or :WaitForChild(), as mentioned ^

0

repeat wait until is a terrible way to wait for something, and should never be encouraged.

2 answers

PlayerGui?? Isnt it StarterGui?? Also wasnt it suppose to be game.StarterGui?? Why is it plr.PlayerGui??

[EDIT]

So this line of code is the error?

if plr.PlayerGui.Waitmove:WaitForChild("Logia") then -- error here

Try this:

if game:WaitForChild("StarterGui").Waitmove:FindFirstChild("Logia") then
-- I mostly use game.StarterGui, but u can change to plr.PlayerGui if u want(which im not sure if it will work)

Try adding an InputEnded function as well.

Also pls describe what u are trying to do here, so i can help, Thanks!

If theres any error, Pls comment below.

[EDIT END]

11 comments

0

Everything in StarterGui clones into the player's PlayerGui. He's doing that part correctly, just the way the script is written is wrong.

0

Just like how everything in StarterPack clones to the Backpack. Backpack and PlayerGui is a descendant of the player.

0

but plr.PlayerGui will not work right??

0

If it did not work, it would error. Please do not answer about things you clearly do not understand.

0

i understand dude, but plr.PlayerGui, will it work?? cause i mostly use game.StarterGui

0

He's on the client side so StarterGui isn't accessible to the client. Search how replication works on the roblox wiki.

0

you cant edit gui's with StarterGui. only in PlayerGui. and if find in StarterGui can player possibly may not have the gui

0

wait lol what? he was trying to edit Gui?

0

what exactly was he trying to do there?? anybody tell me?? i wasnt thinking the same as what he was trying to do there lol

0

He was not trying to edit the gui. I just speaked this for you know. but if you use StarterGui for find the GUI. will find but its not PlayerGui. He will find something that has already been created, you need to try to found with PlayerGui for Find the correct gui. not with StarterGui. See this: StarterGui vs PlayerGui - https://wiki.roblox.com/index.php?title=Player_vs._Starter_GUIs

0

So what exactly was he trying to do??

Its simple, try to use location:WaitForChild("Object_Name")

Here is a example:

local plr = game.Players.LocalPlayer
plr:WaitForChild("Backpack") -- Wait for Backpack

print("Backpack found!")

local plr = game.Players.LocalPlayer
local backpack = plr:WaitForChild("Backpack") -- Wait for Backpack

print("Backpack found!")
backpack:WaitForChild("Any_Item"):Clone()

You can try this:

--<<< StarterGui or StarterPlayerScripts

local plr = game.Players.LocalPlayer
local input = game:GetService("UserInputService")
local remote = game.ReplicatedStorage:WaitForChild("Yami2") -- Added WaitForChild here.
local db = true
local plrgui = plr:WaitForChild("PlayerGui") -- Wait for PlayerGui in player.
local gui = plrgui:WaitForChild("Waitmove") -- Wait for Waitmove in PlayerGui

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.

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