Basically tried to make an energy bar.
1 | script.Parent.Parent.Energy.Text = script.Parent.Parent.Energy.Integer.Value |
Text is always equal to Integer Value..
1 | local Energy = script.Parent.Parent.StarterGui.StatsGui.Frame.Energy.Integer |
2 | Energy = Energy - 1 |
So when a player uses the magic, the Integer will -1 one but i get error :(
1 | 23 : 12 : 23.086 - StarterGui is not a valid member of Player |
2 | 23 : 12 : 23.087 - Script 'Players.Player.Backpack.WizardStaff' , Line 73 |
3 | 23 : 12 : 23.087 - Stack End |
Sos :(!
Players use PlayerGui
Just as the error says, StarterGui
is not a member of Player - PlayerGui
is. When a Player respawns, the StarterGui is typically cloned over into the PlayerGui.
StarterGui isn't copied over to Player, only the contents of StarterGui.
1 | local Energy = script.Parent.Parent.StatsGui.Frame.Energy.Integer |
Something like that should fix it. Basically just remember that StarterGui is not copied over, so it's never part of the Player
1 | script.Parent.Parent.Energy.Text = "" ..script.Parent.Parent.Energy.Integer.Value.. "" |
Text needs a string value, but I'm guessing that Integer has an Int value. We need to put the Int value inside of a String value to get it working properly. That should fix it