09:17:30.968 - Text is not a valid member of PlayerGui
09:17:30.971 - Stack Begin
09:17:30.972 - Script ‘Players.Player2.PlayerGui.LocalScript’, Line 3
09:17:30.968 - Text is not a valid member of PlayerGui
09:17:30.971 - Stack Begin
09:17:30.972 - Script ‘Players.Player2.PlayerGui.LocalScript’, Line 3
Did you put the script inside the textlabel or the gui?
The LocalScript is a child of the PlayerGui, and script Parent will just refer to the PlayerGui. This should be in a text label, not the PlayerGui
if the error is coming from this script, then script.Parent here is PlayerGui, which has no Text property and is a container into which all Guis in StarterGui are replicated for every player, you meant to do something like
local status = game:GetService("ReplicatedStorage").Status
-- don't use WaitForChild here
script.Parent.Text = status.Value
status.Changed:Connect(function(v) -- v is passed as the new value
script.Parent.Text = v
end)
The Changed event only fires for changes in value for ValueBase objects, use that over :GetPropertyChanged(value), it passes the new value as well.
In this case, script.Parent would have to be the TextLabel, or otherwise you would modify the current script (changing :GetPropertyChangedSingal to .Changed too) and index the TextLabel as
script.Parent.TextLabel.Text = status.Value
@Raretendoblox
This is happening because your script is not parented to a TextLabel. It is parented to the PlayerGui directly. Make sure your LocalScript is a child of a TextLabel.
Yea you did, what? That doesn’t answer the question, however it’s very evident that it’s a child of the PlayerGui and not the Text label itself. You can either put the script in the TextLabel itself, or reference it from the PlayerGui by relative reference
@XxELECTROFUSIONxX Why not use WaitForChild? Instances, for sure, aren’t always going to load instantaneously and will error if the object doesn’t exist yet. This is just for precautionary measures.
Back to the @OP: Do you mind showing the hierarchy (parent tree) of the gui, including the StarterGui, the local script and the TextLabel?
Someone is trying their best to help you and you act like that? Thats not the proper response.
I was suggesting not to use Instance:WaitForChild() because on the Server its contents exist implicitly and for the Client, ReplicatedStorage’s contents are replicated by the time code in a local script executes.
Calling :WaitForChild() on an instance under ReplicatedStorage is unnecessary, dot syntax works good.
Why doesnt he just use another path, it says it cant find text inside of the playergui only.
He has to add the screengui aswell and maybe that will work??
He can you another path if he wishes. Though I believe it is more organized to have the script as a child of the TextLabel as it looks like the script only interacts with the TextLabel.
I tried the most common idea u guys recommended and now it says this: [Script ‘Players.Player2.PlayerGui.ScreenGui.TextLabel.LocalScript’, Line 4] so do i have to remove it from the screen gui
Thats not to actual Error message. Thats the path to the Script
I think vong25 solved it thanks for the help