Problem with change IntValue

local damageCount = script.Parent
local damage = game:GetService("StarterPack").Combat.Damage
print(damage.Value) -- printing

if damage.Value == 5 then
	damageCount.Text = damage.Value -- It's working

	print("1") -- not printing
	damageCount.Text = damage.Value

So, I have the script which change my DamageValue, for example I make 5 damage. The text it’s 5. And if i will make 9 damage, the text will be 9.

but function can’t work.

It’s were my text and damageValue.

I do not know why it does not work because when I watched the same problem it worked for all, what is the problem?

Instead of GetPropertyChanged, try .Changed by itself. It will also parse the new value through the connection, how convienient!

docs: IntValue | Roblox Creator Documentation

Let me first say this: it’s not ideal to place a Script inside of a player’s graphical user interface. Instead, use a LocalScript. The server can access a Player’s PlayerGui; I think it’s best to keep Scripts inside Tools, ServerScriptService and the services that were made for Scripts, though.

Your problem may be that you are accessing the StarterPack’s Damage IntValue rather than the one in the Tool copied inside the Player. The point of the StarterPack is just to hold Tools that will be cloned to the Player’s Backpack when their character spawns and respawns, from what I know.

The Script inside the Combat Tool is changing the Damage IntValue inside of that copied Tool that is now in the Player’s Backpack, not the IntValue inside of StarterPack, right?
For this reason, I recommend updating the GUI (graphical user interface) inside of the CombatTool LocalScript, or, from the script inside DamageTest, get the Player’s Tool and use the Damage IntValue inside of that.

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