Hello I am trying to make a server message system but when it tries to update the gui that displays the server message it says that something is not a valid member…
Here are my scripts:
This first one is a local script
local RemoteEvent = game.ReplicatedStorage.ServerMessage
local RemoteEventClient = game.ReplicatedStorage.ServerMessageClient
local ServerMessage = game.Players.LocalPlayer.PlayerGui.ServerMessage.ServerMessageText.Text
script.Parent.MouseButton1Click:Connect(function(Player, message)
local text = game.Players.LocalPlayer.PlayerGui.TesterMenu.TesterMenu.ServerMessage.ServerMessageText.Text
message = text
RemoteEvent:FireServer(tostring(message))
end)
RemoteEventClient.OnClientEvent:Connect(function(Player, message)
print("Client Recieved")
local ServerMessageString = tostring(message)
ServerMessage = ServerMessageString
end)
This one is a server script
local RemoteEvent = game.ReplicatedStorage.ServerMessage
local RemoteEventClient = game.ReplicatedStorage.ServerMessageClient
RemoteEvent.OnServerEvent:Connect(function(Player, message)
print("Server Recieved")
RemoteEventClient:FireAllClients(Player, message)
print("Server Sent")
end)
Here is where the gui that it says isn’t a member is
Have you tried using :WaitForChild()? You might be getting that error due to the fact that the object hasn’t been loaded into the game (or player, for that matter) yet.
Thanks that worked, but at the bottom of the local script where it sets the text value for the server message I have to do “game.Players.LocalPlayer.PlayerGui.ServerMessage.ServerMessageText.Text” instead of the variable name ServerMessage otherwise it won’t change the text.
Try removing the .Text part from the variable and writing it as ServerMessage.Text on that line (and anywhere else where it’s needed). If you define a variable as a property, the variable becomes the value of the property and can’t be changed. I hope that wasn’t too confusing to understand; I haven’t touched Roblox Studio for a while.