So I have this script located in a textbox, located in a frame, located in a billboard gui, located in a players head. So any help with this script not working?
local character = script.Parent.Parent.Parent.Parent.Parent
local Player = game.Players:GetPlayerFromCharacter(character)
Player.leaderstats.FirstName.Changed:Connect(function(newValue)
if newValue == true then
script.Parent.Text = Player.leaderstats.FirstName
end
end)
It’s hard for us to tell without having access to the place but I’d start by throwing in some print statements so you can see what’s not working.
local character = script.Parent.Parent.Parent.Parent.Parent
local Player = game.Players:GetPlayerFromCharacter(character)
Player.leaderstats.FirstName.Changed:Connect(function(newValue)
print("Changed")
if newValue == true then
print("NewValue is true")
script.Parent.Text = Player.leaderstats.FirstName
end
end)
But I’m guessing your issue is with “if newValue == true then”. Instead of checking if it equals true, instead check if it exists. So try replacing that line with “if newValue then” and use those print statements to see what the output is telling you.
remove the
if block
newValue is a string it will never == true
you can
if newValue then
but that is redundant since that’s why the event is firing.
try this
local character = script.Parent.Parent.Parent.Parent.Parent
local Player = game.Players:GetPlayerFromCharacter(character)
Player.leaderstats.FirstName.Changed:Connect(function(newValue)
script.Parent.Text = newValue
end)
local player = script.Parent.Parent.Parent.Parent.Parent.Parent
local Character = player.Character
script.Parent.MouseButton1Click:connect(function()
player.leaderstats.FirstName.Value = script.Parent.Text
Character.Head.Title.F.T.Text = player.leaderstats.FirstName.Value.." "..player.leaderstats.LastName.Value
end)
So the way I change the value of the name is by clicking a button, at first I tried to have it change when the text got updated, but now im trying to make it change when you actually click the name.