I’m making a game where every second the player gains strength and this is my strength multiplier in the DataStore, the print() is returning the multiplierST.Value default as i set and expected (1), but from the strength giver script, and from the explorer it’s set to 0, how can i fix it?
My datastore:
local Multipliers = Instance.new("Folder") -- Sets up Multipliers folder
Multipliers.Name = "Multipliers"
Multipliers.Parent = player
local multiplierST = Instance.new("IntValue")
multiplierST.Name = "MultiplierST"
multiplierST.Parent = Multipliers
multiplierST.Value = 1
print("MultiplierST Value:", multiplierST.Value)
My strength giver script:
local strengthAdd = 5
local defenseAdd = 5
local healthIncrease = 2
while wait(1) do
local char = player.Character
if char then
local humanoid = char:FindFirstChild("Humanoid")
if humanoid then
player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + (strengthAdd * player.Multipliers.MultiplierST.Value)
player.leaderstats.Defense.Value = player.leaderstats.Defense.Value + defenseAdd
humanoid.Health = player.leaderstats.Defense.Value + healthIncrease
humanoid.MaxHealth = player.leaderstats.Defense.Value + healthIncrease
end
end
end
Is the value 1 on the server still? Maybe it’s being set to 0 on the client instead. Or maybe the value is cloned on the client and it doesn’t replicate?
So something is changing the value back, only on the server. Unfortunatly there’s no way to trace back what script indirectly triggered, to see what did it. Likely, it’s the script your working with or something else that uses the value. You should try to use Ctrl + Shift + F to find a value in all scripts. Try searching for the name of your int value, specially .Value with it as well.