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

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

Asked by 7 years ago

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

Log in to vote
0
Answered by
xEmmalyx 285 Moderation Voter
7 years ago

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!

1
I put the script in starterpack and changed it to local and now the label says nothing shankable 9 — 7y
0
Thank you, your way helped shankable 9 — 7y
0
np xEmmalyx 285 — 7y
Ad
Log in to vote
0
Answered by
FiredDusk 1466 Moderation Voter
7 years ago

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

Answer this question