How can i make a number value in a tool change text in a text label to that number value?

How can i make a number value in a tool change text in a text label to that number value?

So you want a TextLabel to change its text when the number value changes?

Simply define the number value and change the TextLabel text property to the value property.

local Players = game:GetService('Players') -- get the players service

local player = Players.LocalPlayer -- the client

local tool = script.Parent -- get the tool
local value = tool:WaitForChild('Number') -- wait for the value

local playerGui = player.PlayerGui -- get the playergui

local gui = playerGui:WaitForChild('TextGui') -- get the ui
local text = gui:WaitForChild('TextLabel') -- wait for the textlabel

text.Text = value.Value -- set the text property

It’s pretty simple, I make my simple codes too long for some reason.

Hey How do i make it update i know use while true but when i uneqip and equip again it doesnt update value anymore please help

nvm i just found it here is my code i remake

script.Parent.Equipped:Connect(function()
local Players = game:GetService(‘Players’)

local player = Players.LocalPlayer 

local tool = script.Parent
local value = tool:WaitForChild('Ammo')

local playerGui = player.PlayerGui

local gui = playerGui:WaitForChild('Kar98KGui') 
local text = gui:WaitForChild('TextLabel')
while gui do
	wait(0.1)
	text.Text = value.Value
end

end)