✓ Accepted answer
First of all, make sure your LocalScript is a descendant of either the StarterGui, StarterPlayerScripts, the player's character, or ReplicatedFirst. Make sure of this, or else the LocalScript will simply not function. To my knowledge, it seems that you have parented the script to a Tool in the backpack, and for the code sample I am providing to work, you must move the script into the StarterGui. If that has been done, then:
It's because you can't assign a property value to a variable to change it by script. This is because the variable does not save the actual instance that the property is of, but instead only the value itself. As an example, that's exactly what you did in line 02, which would be the same as setting local fistText = (the text). In order to fix this, you must instead set it like this:
local plr = game.Players.LocalPlayer
local fistValue = 0
local fistText = script.Parent.ScreenGui.Menu.MenuGUI.StatFrame.Strenght
local fistTool = plr.Character.Tool
local cooldown = false
fistText.Text = ("Strenght:")..(fistValue)
fistTool.Activated:Connect(function()
if not cooldown then
fistValue += 1
print(fistValue)
fistText.Text =("Strenght:")..(fistValue)
cooldown = true
wait(1.3)
cooldown = false
end
end)
2 comments
Is your script's parent a number value?
No, the script's parent is the fistTool.