How do i make value higher each time other value become value*10

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Title
  2. What is the issue? Include screenshots / videos if possible!
    Idk how to do that + my mechanism rn isn’t working
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tryed to use while loop, but it’s too op, value go very high

My code:

local PlayersService = game:GetService("Players")
local Player = PlayersService.LocalPlayer
local PlayerGui = Player.PlayerGui
local Points = Player.leaderstats.Points
local MorePointsButton = script.Parent
local GameGUI = PlayerGui.GameGUI
local StatsFolder = GameGUI.GameFrame.PlayableFrame:WaitForChild("Stats")
local PointsMulti = StatsFolder.PointsMulti
local RebirthMulti = StatsFolder.RebirthMulti
local UpgradeCost = StatsFolder.PIUpgradeCost
local PriceMulti = 0
MorePointsButton.MouseButton1Click:Connect(function()
	print("PlayerClicked!")
	if Points.Value >= UpgradeCost.Value then
		print("PlayerHaveEnoughPoints!")
		PointsMulti.Value = PointsMulti.Value + (1 * RebirthMulti.Value)
		UpgradeCost.Value = UpgradeCost.Value + ((0.5 + (RebirthMulti.Value/5)) * (PriceMulti - 1))
		Points.Value = Points.Value - UpgradeCost.Value
	else
		print("Player Don't have enough points!")
	return
		end

end)

if UpgradeCost.Value >= 100 or 1000 or 10000 or 100000 or 1000000 or 10000000 or 100000000 or 1000000000 or 10000000000 then -- Value Increaser
	PriceMulti = (PriceMulti + 1)* 5
	wait(5)
end
1 Like
if UpgradeCost.Value % 10 == 0 then
	PriceMulti = (PriceMulti + 1)* 5
	wait(5)
end

This code runs when UpgradeCost.Value is a multiple of 10

1 Like
local PlayersService = game:GetService("Players")
local Player = PlayersService.LocalPlayer
local PlayerGui = Player.PlayerGui
local Points = Player.leaderstats.Points
local MorePointsButton = script.Parent
local GameGUI = PlayerGui.GameGUI
local StatsFolder = GameGUI.GameFrame.PlayableFrame:WaitForChild("Stats")
local PointsMulti = StatsFolder.PointsMulti
local RebirthMulti = StatsFolder.RebirthMulti
local UpgradeCost = StatsFolder.PIUpgradeCost
local PriceMulti = 0

MorePointsButton.MouseButton1Click:Connect(function()
	print("PlayerClicked!")
	if Points.Value >= UpgradeCost.Value then
		print("PlayerHaveEnoughPoints!")
		PointsMulti.Value += (1 * RebirthMulti.Value)
		UpgradeCost.Value += ((0.5 + (RebirthMulti.Value/5)) * (PriceMulti - 1))
		Points.Value -= UpgradeCost.Value
	else
		print("Player Don't have enough points!")
		return
	end
end)

UpgradeCost.Changed:Connect(function()
	if UpgradeCost.Value % 100 == 0 then --if number is divisible by 100
		if string.match(tostring(UpgradeCost.Value), "^1[0]+$") then --if number starts with 1 and only has 0's which follow
			PriceMulti = (PriceMulti + 1)* 5
			wait(5)
		end
	end
end)

You need to wrap the checker in a “Changed” event otherwise the if conditional statement will only ever be executed once. Now whenever the value of “UpgradeCost” changes the check is performed. The check determines if the value is divisible by 100 and then ensures that the number starts with 1 and is only followed by 0’s.

1 Like

Thanks, amma try that 30 lettersss

1 Like

Uhmm, it’s works but now price is lowering

image

1 Like

I didn’t change any of the formulas.

That’s odd then, hmmmmmmmmmmmmm

Oh wait nah, that’s just the purchase.

image

PriceMulti starts at 0 which means the bit before the “*” ends up being multiplied by -1.

Oh wait, bru, yeah am stupid lool

1 Like

Bruh script broke when i removed that part…

1 Like

This is no longer relevant, please ignore.

1 Like

Okay nvm fixed that problem, thanks you

1 Like

Hmmm checked if it works, it’s don’t multiple price, it was 0.7 each time and after it reach 100 it’s still 0.7

1 Like
local PriceMulti = 0
PriceMulti = (PriceMulti + 1)* 5
1 Like

Same lol 30 letterssssssssssssss

Does the UpgradeCost value go to exactly 100 or does it sometimes skip past the numbers?

Oh nvm, i had PriceMulti 2 but this mustn’t break it??

1 Like

Skip because it’s 0.7 each time not 1