Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Struggling to find bug in my script from my clicker game?

Asked by 2 years ago

So I have been making this game and I'm trying to add an upgrading system. But the script that meant to be the automated stuff your making isn't working with the rework. The goal here is to combine the number of buildings you have by the multiplier from the upgrade. There is no error in the console. This script is a server script which is located in ServerScriptService. The hi's do print but the Chocolate leaderstat does not rise. Script:

01local NOMC = game.Workspace.MCbutton.Top.Script.NOMC
02local NOB = game.Workspace.Bbutton.Top.Script.NOB
03local NOC = game.Workspace.Cbutton.Top.Script.NOC
04local MCmulti = NOMC.Parent.MCmulti
05local Bmulti = NOB.Parent.Bmulti
06local Cmulti = NOC.Parent.Cmulti
07local MC = NOMC.Value * 1 * MCmulti.Value
08local B = NOB.Value * 5 * Bmulti.Value
09local C = NOC.Value * 25 * Cmulti.Value
10 
11game.Players.PlayerAdded:Connect(function(player)
12    while true do
13        player:WaitForChild("leaderstats").CPS.Value = MC + B + C
14        if player.leaderstats.CPS.Value >= 20 then
15            print("hi")
View all 26 lines...

1 answer

Log in to vote
1
Answered by 2 years ago

I have figured it out! Finally! I had to set some of the values inside of the while true do and now it works flawlessly! Thanks me!

Ad

Answer this question