Whenever i reach the dedicated amount of money, it will not print nor add the level
Code:
local passId = 106685254
function isAuthenticated(player)
return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end
function Start(plr)
print(plr.Name .. " has bought the game pass with id " .. passId)
local Player = game.Players.LocalPlayer
local Money = Player:WaitForChild('leaderstats'):WaitForChild('Money')
script.Parent.MouseButton1Click:Connect(function()
Money.Value = Money.Value + 3
end)
end
game.Players.PlayerAdded:connect(function(plr)
if isAuthenticated(plr) then
Start(plr) -- activate function
end
end)
local Player = game.Players.LocalPlayer
local Money = Player:WaitForChild('leaderstats'):WaitForChild('Money')
local Level = Player:WaitForChild('leaderstats'):WaitForChild('Level')
script.Parent.MouseButton1Click:Connect(function()
Money.Value = Money.Value + 3
end)
while true do
if Money >= 0 then
print("lvl 1")
end
if Money >= 100 then
print("lvl 2")
Level.Value = Level.Value + 1
end
if Money >= 200 then
print("lvl 3")
Level.Value = Level.Value + 1
end
if Money >= 4100 then
print("lvl 4")
Level.Value = Level.Value + 1
end
if Money >= 800 then
print("lvl 5")
Level.Value = Level.Value + 1
end
if Money >= 1600 then
print("lvl 6")
Level.Value = Level.Value + 1
end
if Money >= 3200 then
print("lvl 7")
Level.Value = Level.Value + 1
end
if Money >= 6400 then
print("lvl 8")
Level.Value = Level.Value + 1
end
if Money >= 12800 then
print("lvl 9")
Level.Value = Level.Value + 1
end
if Money >= 25600 then
print("lvl 10")
Level.Value = Level.Value + 1
end
end
I'm new to coding on roblox so if you see the most disorganized and cluttered code in existence, its because I'm new

4 comments
Change "if Money >=" --> "if Money.Value >="
I would convert all the if statements from line 32 to line 70 into a giant if else statement
I'll try both of these things, thank you!
It worked!! Thanks!