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

[SOMEONE HELP PLS??!!] Server isn't detecting the gui inside playergui?

I don't know what it is about these lines of code, but the server just doesn't agree with them or something. I can even check while testing the game whether or not the "pressEgui" is in PlayerGui ; it is! Im so flabbergasted i need help.

    --// Variables \\--

local part = game.Workspace.Part

local plr = game.Players.LocalPlayer

local mouse = plr:GetMouse()

  

--gui variables

local eGui = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui").pressEgui.eGui

local basic = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui").ChooseDifficulty.BasicButton

--// Actions \\--

  

part.Touched:Connect(function()

if plr.Seated == true then

eGui.Visible = true

end

end)

  

mouse.KeyDown:Connect(function(Key)

if Key == "e" then

basic.Visible = true

end

end)

  

basic.MouseButton1Click:Connect(function()

basic.Visible = false

end)

Tysm! error ; pressEgui is not a valid member of playergui

6 comments

0

Is this a local script? You can only mention PlayerGui inside a localscript.

0

The server doesnt know who the localPlayer is, and GUIs are cloned from StarterGui to PlayerGui locally

0

Double check the spelling of the code and the actual GUI

0

Checked the spelling ; this isn't the whole script.

0

its whole now C:

0

Is this a Script or a LocalScript and where is it located?

2 answers

By what I currently see, you are trying to define Player by using "LocalPlayer" in a server script, I don't know why you'd even do that, but that is incorrect, there's also no way to get the mouse object while server-sided.

You also shouldn't expect changes to GUIs or even new GUIs created by the client to be replicated over to the server, so any changes you do VIA a LocalScript will stay local in this case.

1 comment

0

I don't believe this is the issue here, if this was written in a server script it would error that "plr" is a nil value before it would error that pressEgui is not a valid member of PlayerGui

The issue here is that your script can't find pressEgui because it does not instantly go to the PlayerGui when the script fires. On line 13 and 15, where you have,

    :WaitForChild("PlayerGui")

this WaitForChild function is not necessary to use on "PlayerGui" because it already exists within the player. To fix your error, you should move your WaitForChild function to right after the PlayerGui. Example:

plr.PlayerGui:WaitForChild("pressEgui")

this should fix the entire issue, but just to be safe you can do the same with line 15. Hope this helps!

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