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

RemoteEvent is not a valid member of PlayerGui. Why?

I've put the remote event in the same folder as the scripts (starterGUI). Yet, it says it is not a valid member even with it is.

player = game.Players.LocalPlayer
player:WaitForChild("PlayerGui")
script.Parent.RemoteEvent:FireServer(player)

2nd script:

script.Parent.RemoteEvent.OnServerEvent:connect(function(player,p)
	game.Workspace.Baseplate.BrickColor = BrickColor.new("Black")
end)

1 comment

0

There's no reason not to parent all RemoteEvents to a descendant of game.ReplicatedStorage. Remotes parented from game.StarterGui won't replicate to the server, so this won't work to begin with.

2 answers

✓ Accepted answer

When i call Events i usually define the event itself E.g:

local Event = script.Parent:WaitForChild("RemoteEvent")

Also i've got a few questions:

  1. Is the remote event named RemoteEvent
  2. Are you sure that the remote event is within 'script.Parent' and not script.Parent.Parent because that error usually only pops up if one the event cannot be found by the server due to the server still loading in therefore you may need to add a delay whilst the game is loading up and two You haven't located the event properly.

If it is to do with the event not being seen by the server then i recommend making the Event its own variable with a "WaitForChild()" as this will hold the script at that line till said remoteEvent is found.

4 comments

0

the remoteevent is called "RemoteEvent" and is in the same folder as the script.

0

Ok, try making the Event a variable as shown above.

0

Thanks.

0

No problem, Happy to help :)

Why would you put a remote event client side? It is extremly easy for exploiters to see what inside their PlayerGui and stuff. They can just do this.

local player = game.Players.LocalPlayer

local i = player.PlayerGui:GetChildren()

print(#i)

--from the i they see how many children there are and then they can see what are they via this, lets suppose the output printed 3.

print(i[1], i[2], i[3])

Now they can see all the childrens inside their PlayerGui and there is a remote event they can fire it.

3 comments

0

Clients always need to be able to see where remotes are to interact with them.

0

Yes but they can interact with it in ReplicatedStorage not in playergui

0

^

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