Multiplication Not Working

After looking at the following script shouldn’t the text label say 1.5? It’s saying 0.015 for some reason.

local plr = game.Players.LocalPlayer
local upgrades = plr:WaitForChild("upgrades"):FindFirstChild("UpgradesNumber") ---When a player first joins upgrades is set to 1

local increase = 1.5

local function updateText(newValue)
    script.Parent.Text = newValue * increase
end

upgrades.Changed:Connect(updateText)
updateText(upgrades.Value)

We don’t know what upgrades is even set to. Is another script writing to it? Test the game and tell us.

Use the common debugging methods. Print out what newValue is before running the equation and go from there.

2 Likes

I know the post is 2 years ago, but for people who come here, you’re multiplying by a number that’s less than 1. For an example, 1.5 * 0.01 gets you 0.015.