✓ Accepted answer
an if statement should be formatted like this
if foo == bar then
print('Hello World!')
end
EDIT:
so your code should be like this.
local speedRunWeather = game.ServerStorage.speedRunWeather
local t = game.StarterGui.changeGUI
if t.Text == "Hey, this is a text." then
speedRunWeather.Parent = game.Lightning
end
It also should be noted that when changing text on a gui, don't save the text as a variable,
Variables in RLua have many types (ex. Bool, String, Instance, etc.)
When you save a variable like you did before
Reference:
local t = game.StarterGui.changeGUI.Text
It saves the Text property of the Instance as a String variable. This means that when you change it later in your code, it isn't changing the text that is on the TextLabel, it is changing the Text variable.
Example:
local textLabel = Instance.new('TextLabel')
textLabel.Text = 'foo'
local Text = textLabel.Text
print(Text)
textLabel.Text = 'bar'
print(Text)
The way to do it correctly is to save the Text variable as the TextLabel's Instance. (Or just reference the TextLabel directly every time)
Example:
local textLabel = Gui.Notification
textLabel.Text = 'foo'
Gui.Notification.Text = 'foo'
Doing this allows you to change the instance's Text property directly, instead of what you did before (saving the text property as a variable).
6 comments
No, He needs to change the text in the playergui not the startergui.
No, he said clearly that the script is in ServerScriptService
Any change in the startergui when the game is running wont replicate to the playergui.
He isn't changing the startergui, he is checking if an already present textlabel in the startergui has a certain text on it, if it does, he changes the lighting
lol sorry my bad.
mm this is compatible to filtering enabled right..