The title explains most of it. I don't know why it's not working and it's bugging me that I can't figure it out. Something this simple just feels weird. I just don't know what I'm doing wrong so please tell me.
This is the error I'm getting:
Players.Player1.PlayerGui.MainScreen.Info.MoneyValue:12: attempt to index global 'name' (a string value)
the code (Localscript):
repeat wait() until game.Players.LocalPlayer ---------------------------------------------------------------------------------------------------- --Insert VARIABLES Below ---------------------------------------------------------------------------------------------------- player = game.Players.LocalPlayer money = script.Parent.MoneyStats moneyvalue = script.Parent.Parent.Money name = script.Parent.Name stop = false ---------------------------------------------------------------------------------------------------- name.Text = player.Name repeat wait() money.Text = "$$$ = " ..moneyvalue.Value until stop == true
So based on what you said about the Name TextLabel thing, Name is a property of script.Parent, since all Instances have names. Just change the name of the TextLabel, and fix the script like so, and you're good to go.
repeat wait() until game.Players.LocalPlayer ---------------------------------------------------------------------------------------------------- --Insert VARIABLES Below ---------------------------------------------------------------------------------------------------- player = game.Players.LocalPlayer money = script.Parent.MoneyStats moneyvalue = script.Parent.Parent.Money name = script.Parent.TEXTLABELNAME --Name the TextLabel something different than "Name" and replace TEXTLABELNAME with it. stop = false ---------------------------------------------------------------------------------------------------- name.Text = player.Name repeat wait() money.Text = "$$$ = " ..moneyvalue.Value until stop == true
I would like to add to what Discern said.
You could change the name of the TextLabel, but it's not completely necessary. There are multiple ways to get a child of an object via a string, so it won't think you're referring to a property.
1. Use brackets.
script.Parent["Name"]
2. Use FindFirstChild()
script.Parent:FindFirstChild("Name")
3. Use WaitForChild()
script.Parent:WaitForChild("Name")
Hope this fixes
repeat wait() until game.Players.LocalPlayer ---------------------------------------------------------------------------------------------------- --Insert VARIABLES Below ---------------------------------------------------------------------------------------------------- player = game.Players.LocalPlayer money = script.Parent.MoneyStats moneyvalue = script.Parent.Parent.Money name = script.Parent.Name stop = false ---------------------------------------------------------------------------------------------------- name.Value = player.Name -- 'name' is a StringValue, not a TextLabel ;) You can't use Text in StringValues since theres no such property. repeat wait() money.Text = "$$$ = " ..moneyvalue.Value until stop == true
Hope this helps! ~marcoantoniosantos3 If doesnt work tell me output