I tried to change the text of a text label in a frame but got this error instead announcement is not a valid member of Frame "Players.Egliod.PlayerGui.Eric.Announcement
My code and frame child and parents are all correct, I think.
local event = game.ReplicatedStorage:WaitForChild("Intercom")
local finished = game.ReplicatedStorage:WaitForChild("announcementFinished")
event.OnClientEvent:Connect(function(text)
script.Parent.Parent.Announcement.Visible = true
script.Parent.Parent.Announcement.announcement = text
task.wait(10)
script.Parent.Parent.Announcement.Visible = false
finished:FireServer()
end)
You are right, I was missing .Text, but now I have another problem. Unable to assign property Text. string expected, got Instance
I am pretty sure I know where the problem is, but I don’t know why.
My script uses remote events to send the text to the server and then back to display for everyone.
Client remote event send:
local event = game.ReplicatedStorage:WaitForChild("Intercom")
script.Parent.Say.Activated:Connect(function()
local text = script.Parent.Text.Text
event:FireServer(text)
end)
SERVER SIDE--------------------- (idk why the lua block doesn't break, sorry)
local event = game.ReplicatedStorage:WaitForChild("Intercom")
event.OnServerEvent:Connect(function(text)
event:FireAllClients(text)
end)
Looking at it, I most definitely am not keen regards naming Text Labels, Buttons, or Boxes as “Text” because Text is considered as a property under Luau, and that’s what I feel could be causing the problem as well. I would recommend renaming it something else just to rule it out.
The first parameter in a .OnServerEvent function is the player instance. So this is what your code should look like:
local event = game.ReplicatedStorage:WaitForChild("Intercom")
event.OnServerEvent:Connect(function(player,text)
-- the 'player' is just for the server to know which client sent the request, the next one is the parameter passed,
event:FireAllClients(text)
end)
I would most definitely say that because the topic of this post is about an Invalid Frame, you should select the post that does address this problem rather than something that isn’t fully in relation to the title above. It could be misleading and people that may look into this solution and find a solution that doesn’t address the specific concern could cause confusion.