Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is the StringValue not changing?

Asked by 7 years ago

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!

0
Please put your link in a link block. Also, read my bio. hiimgoodpack 2009 — 7y
0
Wait, this is happening to me too! ohhel 2 — 7y
0
Look at the answer, it works :)! Starhawke_r 11 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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!

1
Yikes! Thanks so much :)! It works. I would up vote, but I need 10 more reputation xD Starhawke_r 11 — 7y
0
All good man legoch12 45 — 7y
Ad

Answer this question