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

I don't know how to use my players name in script?

Asked by 6 years ago
Edited 6 years ago

Here is the code that I am using. What I need to do is add a part in the area that checks if the player already has the title "None" that changes the player's Stats or if they don't have the title removes stats. The Stats are located in game.ReplicatedStorage and the folder is within the players name, the issue is I cannot figure out how to make it work to find the player's name in the folder.

01local Button = script.Parent
02local player = game.Players.LocalPlayer
03 
04function onClick()
05if player.TitleFolder.Titles.Value ~= "None" then -- if title isn't "none"
06    wait(.01)
07    player.TitleFolder.Titles.Value = "None" -- Changes title
08    script.Parent.Parent.Parent.Title.Text = "Noob!"
09    local Title1 = Instance.new("BillboardGui",player) -- adds the title to player
10Title1.Name = "TitleGUI1"
11wait(0.02)
12print("title changed")
13elseif player.TitleFolder.Titles.Value == "None" then -- Checks if title is "none" & checks text
14    script.Parent.Parent.Parent.Title.Text = "Noob!"
15    wait(.01)
View all 21 lines...

This is a LocalScript inside of a button, once clicked it changes the player's "Title" by checking for the "Title" value inside of the player. I am trying to make the Title give stats once equipped and removed if changed. Any help will be appreciated thanks

1 answer

Log in to vote
0
Answered by 6 years ago

Found out by many searches, using FindFirstChild(player.Name) when player is defined by localplayer

Ad

Answer this question