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 5 years ago
Edited 5 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.

local Button = script.Parent 
local player = game.Players.LocalPlayer

function onClick()
if player.TitleFolder.Titles.Value ~= "None" then -- if title isn't "none"
    wait(.01)
    player.TitleFolder.Titles.Value = "None" -- Changes title 
    script.Parent.Parent.Parent.Title.Text = "Noob!"
    local Title1 = Instance.new("BillboardGui",player) -- adds the title to player
Title1.Name = "TitleGUI1"
wait(0.02)
print("title changed")
elseif player.TitleFolder.Titles.Value == "None" then -- Checks if title is "none" & checks text
    script.Parent.Parent.Parent.Title.Text = "Noob!"
    wait(.01)
print("same title")
end
end


Button.MouseButton1Click:connect(onClick)

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 5 years ago

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

Ad

Answer this question