This is the code:
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
money = Instance.new("IntValue")
money.Name = "Money"
money.Parent = leaderstats
money.Value = 0
---------------------------------------------------------------------
multiplier = Instance.new("IntValue")
multiplier.Name = "Multiplier"
multiplier.Parent = player
multiplier.Value = 1.0
---------------------------------------------------------------------
leaderstats.Parent = player
end) :
workspace:WaitForChild("Upgrades"):WaitForChild("Upgrade_1"):WaitForChild("ClickDetector").MouseClick:Connect(function(player)
workspace:WaitForChild("Upgrades"):WaitForChild("Upgrade_1"):WaitForChild("ClickDetector"):Destroy() -- Removes ClickDetector
local money = player:WaitForChild("leaderstats"):WaitForChild("Money")
--------------------------------------------------------------------- ---------------------------------------------------------------------
while True wait(0.025) do
local currentMultiplier = player:WaitForChild("Multiplier").Value
money.Value = money.Value + (1.0 * currentMultiplier)
end
end)
The problem is that when I change the multiplier.Value
in Roblox Studio, it doesn't change in the code. However, when I change it in the code, it works fine. I don't know how to get the code to update when I change the variable manually in Roblox Studio.
One of my theories is that money.Value
is not checking if the variable changed while the loop is running.
multiplier.value
"? Ismultiplier
anIntValue
in your workspace? If it is, when is it created? Where is it located? I have a suspicion as to what's happening, but I can't be sure without a little more information.