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

[SOLVED] I have a very big bug breaking issue. Can only find the solution to this error?

Asked by
Cowgato 33
2 years ago
Edited by Xapelize 2 years ago

This question has been solved by the original poster.

The scripts that I have will be pretty long so bear with me (however, I will show you which section of the script is mainly important to this issue)

I am trying to make a data storage system in my module script. What I am trying to attempt is saving the players money, however, if I use a certain script, the game can't recognize the value of the money and I get an error message saying this: ServerScriptService.Components.Button:35: attempt to compare number <= nil (this error message applies to another module script btw)

The script below works fine for other things except for the money system: (look near the bottom of script)

001local Players = game:GetService("Players")
002local DataStoreService = game:GetService("DataStoreService")
003local PlayerData = DataStoreService:GetDataStore("PlayerData")
004 
005local function LeaderboardSetup(value)
006    local leaderstats = Instance.new("Folder")
007    leaderstats.Name = "leaderstats"
008 
009    local money = Instance.new("IntValue")
010    money.Name = "Money"
011    money.Value = value
012    money.Parent = leaderstats
013    return leaderstats
014end
015 
View all 122 lines...

However, the script below breaks the money system and can't recognize it: (look near the bottom of script again)

001local Players = game:GetService("Players")
002local DataStoreService = game:GetService("DataStoreService")
003local PlayerData = DataStoreService:GetDataStore("PlayerData")
004 
005local function LeaderboardSetup(value)
006    local leaderstats = Instance.new("Folder")
007    leaderstats.Name = "leaderstats"
008 
009    local money = Instance.new("IntValue")
010    money.Name = "Money"
011    money.Value = value
012    money.Parent = leaderstats
013    return leaderstats
014end
015 
View all 115 lines...

I'm really sorry if this is hard to follow through without much context, but any help would be extremely appreciated!

1 answer

Log in to vote
0
Answered by
Cowgato 33
2 years ago

Sorry guys, I've figured it out. Just decided to work for some reason haha

Ad

Answer this question