Text not changing to player’s name. This is in a LocalScript.
local menu = script.Parent
local loading = menu.LoadingText
local play = menu.Play
local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
local nametext = menu.TitleFrame.Name.Text
nametext = plr.Name
--[[
There is more script below this
but not relevant to my problem.
I tried searching the issue on
google, but no results. I got this
error in the output:
"attempt to index string with 'Text' ..."
--]]
Try this:
local nametext = menu.TitleFrame.Name
nametext.Text = plr.Name
instead of
local nametext = menu.TitleFrame.Name.Text
nametext = plr.Name
EDIT: Nevermind, the script probably thinks you’re getting a property called Name, do:
local nametext = menu.TitleFrame:WaitForChild("Name")
nametext.Text = plr.Name
1 Like
Ha, yes it did think that it was a property! It works now! Thanks very much for your help!
Have a good day!
1 Like
local menu = script.Parent
local loading = menu.LoadingText
local play = menu.Play
local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
local nametext = menu.TitleFrame.Name
nametext.Text = plr.Name
The reason this happened is because you assigned the current value of the property named “Text” of the “Name” label to the variable named “nametext” as such when you next assigned a value to the variable named “nametext” you were just overriding the previous value which was written their & not changing the value of the property named “Text” of the label named “Name”.
1 Like