To be honest, it's probably because of bad coding. This is what I have; A script in a spawn location in the workspace;

script.Parent.Touched:Connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		local uniqueK = "id-"..(game.Players:GetPlayerFromCharacter(hit.Parent)).UserId
		local W1 = game:GetService("DataStoreService"):GetDataStore("World2")
		local G1 = W1:GetAsync(uniqueK)
		local W2 = game:GetService("DataStoreService"):GetDataStore("World1")
		local G2 = W2:GetAsync(uniqueK)
		local O1 = 0
		local O2 = 0
		if G2 then
			O2 = G2[10]
		end
		if G1 then
			O1 = G1[10]
		else
			O1 = game.Players:GetPlayerFromCharacter(hit.Parent).OBOS.Value
		end
		local val = 0
		print("running")
		for _,v in pairs(game.Players:GetPlayerFromCharacter(hit.Parent):GetChildren()) do
			if v:IsA("BoolValue") then
				if v.Value == true then
					val = val + 1
					game.Players:GetPlayerFromCharacter(hit.Parent):WaitForChild("leaderstats"):WaitForChild("Obbies Beaten").Value = val + O1 + O2
				end
			end
		end
		game.Players:GetPlayerFromCharacter(hit.Parent):WaitForChild("leaderstats"):WaitForChild("Obbies Beaten").Value = O1 + O2
	end
end)

A script i have in ServerScriptService:

local DSService = game:GetService("DataStoreService"):GetDataStore("World2")
game.Players.PlayerAdded:connect(function(player)
 local Stats = Instance.new("Model", player)
 Stats.Name = "leaderstats"
 local Timer = Instance.new("IntValue", Stats)
 Timer.Name = "Obbies Beaten"
 Timer.Value = 0
 local W1 = Instance.new("IntValue", player)
 W1.Name = "OBOS"
 W1.Value = 0
 local A = Instance.new("BoolValue", player)
 A.Name = "O1"
 A.Value = false
 local B = Instance.new("BoolValue", player)
 B.Name = "O2"
 B.Value = false
 local C = Instance.new("BoolValue", player)
 C.Name = "O3"
 C.Value = false
 local D = Instance.new("BoolValue", player)
 D.Name = "O4"
 D.Value = false
 local E = Instance.new("BoolValue", player)
 E.Name = "O5"
 E.Value = false
 local F = Instance.new("BoolValue", player)
 F.Name = "O6"
 F.Value = false
 local G = Instance.new("BoolValue", player)
 G.Name = "O7"
 G.Value = false
 local H = Instance.new("BoolValue", player)
 H.Name = "O8"
 H.Value = false
 local I = Instance.new("BoolValue", player)
 I.Name = "O9"
 I.Value = false
 local uniqueK = "id-"..player.userId
	local GetSave = DSService:GetAsync(uniqueK)
	
	if GetSave then
		A.Value = GetSave[1]
		B.Value = GetSave[2]
		C.Value = GetSave[3]
		D.Value = GetSave[4]
		E.Value = GetSave[5]
		F.Value = GetSave[6]
		G.Value = GetSave[7]
		H.Value = GetSave[8]
		I.Value = GetSave[9]
	else
		local NumbersForSaving = {A.Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value, I.Value, W1.Value}
		DSService:SetAsync(uniqueK, NumbersForSaving)
	end
end)
game.Players.PlayerRemoving:Connect(function(plr)
	local uniqueK = "id-"..plr.userId
	local saveTbl = {plr.O1.Value, plr.O2.Value, plr.O3.Value, plr.O4.Value, plr.O5.Value, plr.O6.Value, plr.O7.Value, plr.O8.Value, plr.O9.Value, plr.OBOS.Value}
	local success, err = pcall(function()
		DSService:SetAsync(uniqueK, saveTbl)
	end)
end)

Another script I have in serverscriptservice:

local val = 0
local W1 = game:GetService("DataStoreService"):GetDataStore("World1")
game.Players.PlayerAdded:Connect(function(plr)
	local uniqueK
	local G1
	uniqueK = "id-"..plr.UserId
	if W1:GetAsync(uniqueK) then
		G1 = W1:GetAsync(uniqueK)
	else
		G1 = 0
	end
	local badge = game:GetService("BadgeService")
	while true do
		val = 0
		for _,v in pairs(plr:GetChildren()) do
			if v:IsA("BoolValue") then
				if v.Value == true then
					val = val + 1
					plr:WaitForChild("leaderstats"):WaitForChild("Obbies Beaten").Value = val + G1[10]
				end
			end
		end
		val = 0
		for _,v in pairs(plr:GetChildren()) do
			if v:IsA("BoolValue") then
				if v.Value == true then
					val = val + 1
					print(val)
					plr:WaitForChild("OBOS").Value = val
				end
			end
		end
		if plr:WaitForChild("OBOS").Value > 8 and badge:UserHasBadgeAsync(plr.UserId,2124444012) == false then
			badge:AwardBadge(plr.UserId,2124444012)
		end
		wait()
	end
end)

I don't know what the hell is going wrong. There are no errors to be shown, plus it only happens for certain people, which is quite odd.

13 comments

0

Any Errors?

0

none whatsoever.

0

Assigning the datastore "World1" to a variable named W2, and "World2" to W1 is just inviting bugs and confusion.

0

thing is i made sure

0

bruh you need to organise more, like don't put a datascript in workspace put it in serverscript service. Also you shouldn't be calling data in two different scripts, and you shouldn't constantly be updating it. Just getAsync when players.PlayersAdded and setAsync when Players.PlayerRemoving

0

Uh, you know about the other 2 scripts are in serverscriptservice?

0

Second. I have a data save for when a playerr leaves and joins a game, can you AT LEAST analyze each script?

0

Another thing. The second script is not constantly doing :SetAsync(), its only to make it accurate.

0

Naming variables letters like A, B, C, etc. is terrible practice.

0

Also, as stated above, giving variables names that do not properly correlate with the value held is a terrible practice.

0

Use variables properly too. Writing "game.Players:GetPlayerFromCharacter(hit.Parent)" more than once is a sign of bad variable logic.

0

Don't pass arguments to the second, deprecated parameter of Instance.new(). https://devforum.roblox.com/t/psa-dont-use-instance-new-with-parent-argument/30296/3

0

You don't need the ":WaitForChild()"s.