So I have a combat system, and recently I made a skill tree that gives the player not 5 damage on his fists, but 10. For this I took my script from the tree, here it is:
local upgradeDamage1 = game:GetService("ReplicatedStorage").upgradedDamage1
upgradeDamage1.Value = true
this is only the part that is responsible for changing the damage, by the way here is the boolValue itself in rp(ReplicatedStorage)
Then in my separate script in tool, I wrote this…
local rp = game:GetService("ReplicatedStorage")
local damage = script.Parent.Damage
while wait(0.5) do
if rp.upgradedDamage1.Value == false then
damage.Value = 5
elseif rp.upgradedDamage1.Value == true then
damage.Value = 10
end
end
and if you go into the game and pump up the damage, it becomes 10…
But the problem is that when I hit him, I only inflicted 5 damage, not 10.
Here is the script where I strike the enemy, if anything it is not local and is near the tool…
local damage = tool.Damage
data.Target.Humanoid:TakeDamage(damage.Value)
What’s the problem? As I understand it is because my non-local script does not see the number change, or it sees a different number
Is the code that changes the Damage Value in a Local Script or Server Script? Because if it’s a Local Script, then that could be why it’s still taking 5 damage instead of 10.
If you are using a Server Script however, how are you changing the ‘upgradeDamage1’ value? Are you changing it from another script, or are you changing it from the Explorer tab while testing?
I’ll tell you more, I tried in my combat no local script to write print(upgradedDamage1.Value), and it said that it equals false, although if you look in explorer it will equal true. That is, it does not see any change at all as I understand it