Text and Value mismatch

I am working on a UI for my gun engine, and came across a huge issue. Whenever I print the ammo value, it is perfectly normal. Whenever I set the textlabel text to it, it is completely wrong.

Video (watch the output and the label) (LOUD SOUNDS!):

Code:

game:GetService("RunService").RenderStepped:Connect(function()
	local ammo = _G.Ammo
	
	if ammo then
		script.Parent.Text = ammo
		print(ammo)
	else
		script.Parent.Text = ""
	end
end)

I have tried reading straight from the actual ammo value, but the same issue happens.

Never had this issue before.

Can you please add this?
print(typeof(ammo))

image

convert it into string with tostring()

Same thing happens, unfortunately.

maybe something else overriding _G.ammo or effecting text label?

Apparently rewriting the code on another UI works fine. Not sure why it didn’t work on this one.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.