Script identifying leaderstats + datastore randomly broke

Script that identifies and handles the functions for my Datastores + leaderstats have randomly broke over the night.



I’ve looked into this - attempting on an older version of my game where I know the leaderstats + datastore had been working & now it won’t work? The only thing I can assume is that this is a ROBLOX update?



Beginning of script:


 local data = Instance.new("Folder",game.ServerStorage)
data.Name = "Data"
local saves = game:GetService("DataStoreService"):GetDataStore("BXMKIIII")
local jail = game:GetService("DataStoreService"):GetDataStore("jailstuff")
local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("NewEXP")
game.Players.PlayerAdded:connect(function(plr)
	repeat wait() until plr
	local leaderstat = Instance.new("Model")
	leaderstat.Name = "leaderstats"
	leaderstat.Parent = plr
	
	local ranktime = Instance.new("IntValue")
	ranktime.Name = "Experience"
	ranktime.Parent = leaderstat
	
	local jailtime = Instance.new("IntValue")
	jailtime.Name = "Prison Time"
	jailtime.Parent = leaderstat
	
	local fines = Instance.new("IntValue")
	fines.Name = "fine"
	fines.Parent = plr
	
	local cash = Instance.new("IntValue", data)
	cash.Name = plr.Name.."Cash"
	
	local money = Instance.new("IntValue", data)
	money.Name = "money"
	money.Parent = plr
local rt = plr.leaderstats["Experience"].Value

Where the error occurs:


   ranktime.Value = myDataStore:GetAsync(plr.userId.."EXP")

	if jail:GetAsync(plr.userId.."PrisonTime")~= nil and jail:GetAsync(plr.userId.."PrisonTime") > 0 then
		jailtime.Value = jail:GetAsync(plr.userId.."PrisonTime")
	end

Error Image:


Screenshot_130


As I’ve said - I haven’t made any changes to this script in weeks. There should be no reason that this is happening - I’ve tried adjusting caps on userid and everything. I’m not sure if ROBLOX pushed out a new update for GetAsync or if the GetAsync featue may be glitching out right now.


Summary:

  • Script broke randomly without any updates being done to it.
  • The script does not have any relative scripts that could affect it if they were updated.
  • The “error” message does not display a cause for this error
  • I’ve double checked the spelling and more multiple times.
  • I do not have any other scripters or developers in general. So there is no way this was updated without me knowing.

Any feedback, help, or shedding any light on this situation in general is BEYOND appreciated.

1 Like

Can you show the error you’re facing?

1 Like

I just noticed after posting that I forgot to attach the image. Forgetful as usual haha, there you go!

Rank time is IntValue you can not add a string to IntValue

It was working yesterday however?

Change IntValue to stringValue for a moment and test

1 Like

it is impossible to add a string to IntValue

1 Like

Same error and now it removed #'s on leaderboard.


And this is the same exact code it was when the script was working. Not sure how to respond to your statement there.


Further proof:



Really stumped on this one.


Hmm… it is very strange…

1 Like

Try enabling these options in

Home > Game Settings > Security


If it won't work try making game private to public.

1 Like

Everything is working now!


Not sure why this error was occuring in-game at first though, I still haven’t exactly changed anything - It may have just been a bugged server somehow? I guess some questions can’t really be answered.


I wasn’t quite aware of the API setting changing so much within studio tests, I appreciate it a lot, thanks!


Time to start cleaning up the game’s scripts so everything is a lot easier to fix in the future.