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

Why is this script saying game instead of the player's name?

this script is meant to get the name of the player and put it on textlabel. way=true while way==true do script.Parent.Text = "" ..script.Parent.Parent.Parent.Parent.Parent.Parent.Name.. "" way=false end

where the script is https://gyazo.com/bd2a809ae81acfcc2e932a8939741aae

instead of saying the player's name it ends up saying game

2 answers

The parent of lighting is game, if you put the script in startergui or starterpack it should work as the parent will then be the player!

3 comments

1

I put the script in starterpack and changed it to local and now the label says nothing

0

Thank you, your way helped

0

np

Please use codeblocks for your code.

Also, I assume this is a LocalScript.

local player = game.Players.LocalPlayer -- accesses the player
local character = player.Character or player.CharacterAdded:Wait() -- waits for the character to be loaded if it is not found

way = true 
while way == true do 
    script.Parent.Text = "" ..player.Name.. "" --I don't see a point in having " " if there is nothing inside of it.
    way = false
end

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