Well, hopefully, you had a backup for that, but I’m not sure why you reset all the data anyways.
The main reason it was broken was because of the datastore. So I just reset the script. Anyway not many players have gotten a ton of progress anyways.
if newPlayer:FindFirstChild("leaderstats") == nil then
local leaderstats = Instance.new("IntValue")
leaderstats.Parent = newPlayer
leaderstats.Name = "leaderstats"
local score = Instance.new("IntValue")
score.Parent = leaderstats
score.Name = "Score"
score.Value = 0
local captures = Instance.new("IntValue")
captures.Parent = leaderstats
captures.Name = "Captures"
captures.Value = 0
-- To crash the default Player List
local haxStr = Instance.new("StringValue")
haxStr.Parent = leaderstats
end
The purpose of making the ‘leaderstats’ an ‘IntValue’ object predates the existence of SetCoreGuiEnabled
.
Cash.Changed:Connect(function(NewCash)
local amt = string.gsub(NewCash, ",", "")
print(amt, tonumber(amt))
if tonumber(amt) >= 500 then
print("Over 500")
end
end)
Use Changed
for value objects.
Using GetPropertyChangedSignal is actually better in this case. I’m not sure why you would want to use Changed. GetPropertyChangedSignal allows me to detect when the value itself changes and nothing else.
https://developer.roblox.com/en-us/api-reference/event/IntValue/Changed
Please read the documentation of the ‘Changed’ event/signal for value objects, it only fires when the object’s ‘Value’ property changes.
Well, didn’t know that Changed worked like that on an IntValue as it works completely different on everything else, so thank you for that.