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

Am i comparing a number to an instance?

Asked by 4 years ago

so i've made the following code

local starterRebirthAmount = 5000

replicatedStorage.Remotes.Rebirth.OnServerInvoke = function(player)

if not remoteData:FindFirstChild(player.name) then return "NoFolder"  end

local rebirths = player.leaderstats.Rebirths

if  player.leaderstats.Rebirths >= ( math.floor((starterRebirthAmount + (rebirths.Value) * math.sqrt(5000000))))then
    rebirths.Value = rebirths.Value + 1

    player.leaderstats.Magic.Value = 0

    player:LoadCharacter()

the starterRebirthAmount is a number and so is rebirths.Value, how can one of them be an instace

Sorry by my english it's not my mother language

0
You forgot to reference the Value of rebirths, and why in the world would you need the square root of five million?? Ziffixture 6913 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Don't worry, we all make mistakes.

You forgot to put the ".Value" thing in the if statement, so that's why you're comparing a number and an instance. Also, is your auto indent on? If not, put the "end" word on the bottom of the if statement.

if not remoteData:FindFirstChild(player.name) then return "NoFolder"  end

local rebirths = player.leaderstats.Rebirths

if  player.leaderstats.Rebirths.Value >= ( math.floor((starterRebirthAmount + (rebirths.Value) * math.sqrt(5000000))))then
    rebirths.Value = rebirths.Value + 1

    player.leaderstats.Magic.Value = 0

    player:LoadCharacter()
end -- don't forget to put it

Have a nice day! I gotta go do some work.

0
Oh god, i'm the dumbest person in the world, it was that simple to solve, thank you very much MonkeyDLuffy354 0 — 4y
Ad

Answer this question