Gui text does not update for some reason

hello, so i have this line of code that is supposed to update the gui’s text, but it isn’t for some reason.

quantity.Value.TextLabel.Text = player.Resources.Wood.Value

this is the wood adding part:


PlayerS.PlayerAdded:Connect(function(player)
	local Resources = Instance.new("Folder",player)
	Resources.Name = "Resources"
	local Wood = Instance.new("NumberValue",Resources)
	Wood.Value = 0
	Wood.Name = "Wood"
end)

and the gui
Screenshot 2023-06-12 at 9.00.01 PM
nothing happenes, i don’t understand what i am missing

1 Like

What is the code for this part that you have to have it change to that?

1 Like

local PlayerS = game:GetService(“Players”)

PlayerS.PlayerAdded:Connect(function(player)
local Resources = Instance.new(“Folder”,player)
Resources.Name = “Resources”
local Wood = Instance.new(“NumberValue”,Resources)
Wood.Value = 0
Wood.Name = “Wood”
end)

Is it suppose to be showing how much wood you have, or something like that?

If so do this.

So, if you want it to show on the GUI. You’d have to put it in a local script.

So, do a script like this.

local player = game.Players.LocalPlayer
local wood = player:WaitForChild(“Resources”).Wood.Value
local Textlabel = script.Parent

Textlabel.Text = tostring("Wood: "…tostring(wood))

The parent of this must be the TextLabel put this local script into the text label.

yup, it is supposd to do that thirtychar

i transfered the script from another game of mine

tool.Equipped:Connect(function()
	equipped = true
	print("equiped")
	player.PlayerGui.Quantity.Value.Visible = true
	quantity.Value.TextLabel.Text = tostring(player.Resources.Wood.Value)
	part.SelectionBox.Transparency = 0.5
	context:BindAction("Drop",function(name,state,obj)
		if state == Enum.UserInputState.Begin then
			player.PlayerGui.Drop.Frame.Visible = not player.PlayerGui.Drop.Frame.Visible
			player.PlayerGui.Drop.Frame.Label.Text = "Dropping: Wood"
		end
	end,false, Enum.KeyCode.Q)
end)
tool.Unequipped:Connect(function()
	equipped = false
	print("unequipped")
	part.SelectionBox.Transparency = 1
	player.PlayerGui.Quantity.Value.Visible = false
	part.Position = Vector3.new(1,1,1)
	context:UnbindAction("Drop")
end)