Info script isn't working for some reason

Trying to make script display info on a gui but for some reason I’m getting the output error :

attempt to concatenate string with RBXScriptConnection

My current script is this :

local plr = game.Players.LocalPlayer

script.Parent:FindFirstChild(“Name”).Text = " " … plr.Name

script.Parent:FindFirstChild(“LV”).Text = "LV " … plr.leaderstats.LV:GetPropertyChangedSignal(“Value”):Connect(function()

script.Parent:FindFirstChild(“G”).Text = "G " … plr.leaderstats.G:GetPropertyChangedSignal(“Value”):Connect(function()

end)

end)

help would be appreciated thank you!

1 Like
local plr = game.Players.LocalPlayer

script.Parent:FindFirstChild("Name").Text = " "..plr.Name

plr.leaderstats.LV:GetPropertyChangedSignal("Value"):Connect(function()
	script.Parent:FindFirstChild("LV").Text = "LV " ..plr.leaderstats.LV.Value
end)

plr.leaderstats.G:GetPropertyChangedSignal("Value"):Connect(function()
	script.Parent:FindFirstChild("G").Text = "G " ..plr.leaderstats.G.Value
end)

Doesn’t seem to cause any errors however the G and LV stat dont show up for some reason
image
Do you possibly know why?
image

1 Like

I think it’s because of the FindFirstChild()? I’m just doing this how I’d do it, personally, as well as doing some features I think might be the problemo

local Player = game.Players.LocalPlayer

local LV = script.Parent:WaitForChild("LV")
local G = script.Parent:WaitForChild("G")

script.Parent:WaitForChild("Name").Text = " "... plr.Name

if (LV.Visible == false) then
   LV.Visible = true
end

if (G.Visible == false) then
   G.Visible = true
end

Players.leaderstats.LV:GetPropertyChangedSignal("Value"):Connect(function()
   LV.Text = "LV ".. tostring(Player.leaderstats.LV.Value)
end)

Players.leaderstats.G:GetPropertyChangedSignal("Value"):Connect(function()
   G.Text = "G ".. tostring(Player.leaderstats.G.Value)
end)
1 Like

Still doesn’t seem to work… I think it may be cause of the leaderstats being a folder and not a model? but I dont think thats the cause as if I do while wait() do it works but I currently don’t want to do that is its inefficient

1 Like

It shouldn’t be because it’s in a folder, that’s what it usually should be in, to make things easier, but it doesn’t really affect anything.

Try using Instance.Changed it should help out because you should be able to do

local Player = game.Players.LocalPlayer

local LV = script.Parent:WaitForChild("LV")
local G = script.Parent:WaitForChild("G")

script.Parent:WaitForChild("Name").Text = " "... plr.Name

if (LV.Visible == false) then
   LV.Visible = true
end

if (G.Visible == false) then
   G.Visible = true
end

Players.leaderstats.LV.Changed:Connect(function(typeof_)
   if typeof_ == "Value" then
      LV.Text = "LV ".. tostring(Player.leaderstats.LV.Value)
   end
end)

Players.leaderstats.G.Changed:Connect(function(typeof_)
   if typeof_ == "Value" then
      G.Text = "G ".. tostring(Player.leaderstats.G.Value)
   end
end)
1 Like
local players = game:GetService("Players")
local player = players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local stat1 = leaderstats:WaitForChild("LV")
local stat2 = leaderstats:WaitForChild("G")

local frame = script.Parent
local lv = frame:WaitForChild("LV")
local g = frame:WaitForChild("G")
local name = frame:WaitForChild("Name")
name.Text = player.Name

stat1.Changed:Connect(function(newlv)
	lv.Text = newlv
end)

stat2.Changed:Connect(function(newg)
	g.Text = newg
end)
1 Like

That’s not how the “.Changed” event works for ValueBase instances (IntValue, StringValue, BoolValue etc.), its parameter doesn’t represent the name of the changed property like “.Changed” does for other instances, its parameter represents the value property’s new value (which resulted in the event firing).

https://developer.roblox.com/en-us/api-reference/event/IntValue/Changed

Thanks! I didnt realise that but now I can use this thank you.

1 Like