Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is the StringValue not changing?

Hello,

I am trying to get a StringValue have the players username, how ever the value isn't updating

My script:

while true do
	wait(0.01)
	local plr = game.Players.LocalPlayer.Name
	script.Player.Value = plr
end

My hierarchy: https://gyazo.com/2ca2662ba8011c6cc57b251df4373cad

Thanks!

3 comments

0

Please put your link in a link block. Also, read my bio.

0

Wait, this is happening to me too!

0

Look at the answer, it works :)!

1 answer

Hey!

First up a local script shouldn't be in the workspace it's best that it goes in a player. If you're trying to get the name of a player into an string try something like this:

wait(3)
script.parent.Value = script.Parent.Parent.Parent.Name

while having the hierarchy like this https://gyazo.com/720630a5c2b5f57ae028651c48261d5f

If you need the player name in the workspace 100% then try something like this

wait(0.01)

local name = Instance.new('StringValue')
name.Parent = workspace
name.Value = script.Parent.Parent.Name

whilst having the script somewhere in the player. I prefer the player Starter pack but it can also go in here https://gyazo.com/cd5458b31d61d78eb259edcf43c0911e

Hope this helps!

2 comments

1

Yikes! Thanks so much :)! It works. I would up vote, but I need 10 more reputation xD

0

All good man

This discussion is preserved as it was. New answers, comments, and votes are closed.