so I am making this phone code, however, it won’t work as when I enter a message it just puts ‘enter message’ when I send a message, could someone help?
script.Parent.Parent.values.newMessage.Value = script.Parent.Parent.Parent.thisPhone.Value … ": " … script.Parent.Parent.MessageBox.Text
local workphone = script.Parent.Parent.Parent.otherPhone.Value
local playerphone = workphone:FindFirstChild(“player”)
if playerphone.Value ~= nil then
local pp = playerphone.Value
pp.PlayerGui.PhoneGUI.ChatScreen.values.newMessage.Value = script.Parent.Parent.Parent.thisPhone.Value … ": " … script.Parent.Parent.MessageBox.Text
It’s hard to follow the code. For now try defining all the times you use script.Parent.Parent.values as a variable so you only have to write that path once. Try to clean up any time you see yourself using the same object twice, you could be writing the path to it only once. And don’t screenshot code, it’s in the rules, and it makes it very hard for us to test the code to see what the problem is.
For now, clean up your code. Make sure each time you reference script.Parent.Parent.values you are instead referencing a variable that stores that object. like this:
local lines = script.Parent.Parent.values
This makes the code a lot easier to read, and a lot easier for us to know what you are doing. each time you reference it after that you could just write “lines” instead of “script.Parent.Parent.values” Also make a new variable for each of the lines inside this values object, thisphone,and newmessage. After that, post your code using the preformatted text feature.
To use it, highlight over all the code you put inside your text and press this button:
To achieve this, you need to understand how to use RemoteEvents; and as this is essentially a chat feature, you need to ensure messages are filtered too.
I suggest you read up on both of these on the wiki. You should not be trying to modify something on one client from another. You should be sending messages to the server, processing it, then returning it to it’s intended recipient.