Everything is run from Client side [There are no Serverscripts in the entire game].
The properties tab clearly show that the value should be 2, but the label displays 3.
I have no clue why this is happening, perhaps an engine bug?
(And yes, the label in the properties is the label highlighted in blue)
Again, I have know way of knowing what the issue is if I can’t see your script… also, in your properties tab it doesn’t say the text is changing, which confuses me even more
Well first, it looks like the term self is already used by Roblox but idk if that’s a problem, but also, are you calling this when your amount of ammo changes or every frame, because if it were me I would use render stepped (but that’s just an opinion).
If that’s not the problem, try checking if any other scripts are interfering, other wise it may be an engine bug and your out of luck.
I’m not sure too, but after thinking about multiple reasons of why it could do it, i didn’t understand why.
Is it a FPS drop ? maybe, not sure if it can do a delay between the text change and the Gui display.
Are you updating it on server side ? no, as i saw your script and you said it is in client side, and i’m not sure if it also can do a delay between both.
Is the ammo value is at like 6.999999 and the text displayed automaticaly rounded it to 7 ? idk, it is a string so it shouldn’t, and if you’re using a intvalue then there can’t be a decimal number.
Could you please show what the variable Frame refers to? Additionally, you could use print(Frame:GetFullName()) in your code.
Also, is there an children inside of this TextLabel? Can you reproduce this error when testing in-game vs. in-studio? Provide a link to a place so that I can help further investigate this issue, if possible.
Look at the video above, Self.Frame is the frame named “GunTemplate” which contain all text information about the gun, and yes the text have childrens like a UiStroke but i don’t think it have something to do with this bug.
Oh, I did not see the explorer on the left in that video, my bad. Kudos to you for pointing that out. However, I highly doubt this is a studio bug. My assumption leads me to believe it is changing the wrong TextLabel’s properties, or that there is some other factor preventing it from updating.
After doing that, the text property in this Text Object is changing correctly and instantly like it should, but the bug is that once the text changed, there is a delay for it to be displayed into the current Gui, like the text is “6” and it display “7” then it wait 3sec to display “6”… it can be nothing else than a small studio bug.
Trust but verify my friend. I still do not think this is a studio bug, but it would not hurt to restart studio by closing it and re-opening it @imlusman.
I have tried to reproduce the error with the same hierarchy. I also updated the TextLabel the same way OP did, and it always updates instantly.
Here is the code (and hierarchy) that I used in my testing environment:
LocalScript in StarterPlayer → StarterPlayerScripts:
-- Client essentials
local player = game:GetService("Players").LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
-- Services
local ContextActionService = game:GetService("ContextActionService")
-- Variables
local mainGui = playerGui:WaitForChild("Main")
local frame = mainGui:WaitForChild("GunTemplate")
local ammo = 30
-- Functions
local function updateAmmoDisplay()
print("Current text:", frame.AmmoInMag.Text)
print("Ammo variable:", ammo)
frame.AmmoInMag.Text = tostring(ammo)
print("Updated ammo text:", frame.AmmoInMag.Text)
end
local function decreaseAmmo(actionName: string, inputState: Enum.UserInputState)
if inputState ~= Enum.UserInputState.Begin then
return
end
ammo -= 1
updateAmmoDisplay()
end
-- For testing:
ContextActionService:BindAction("DecreaseAmmo", decreaseAmmo, false, Enum.UserInputType.MouseButton1)
I have done some testing and this is what I found out:
I tried to restart Studio and the bug still occurred
I tried to open the place on another device in studio and the bug still occurred
I tried to publish it and play on the roblox website and the bug still occurred