What can be the other possibilities? Maybe try the script in another game and let me know if it doesn’t print any warning. This is probably one of your scripts except what I wrote above.
Where did you get that from? Its just a script spamming a warning.
Thats literally the worst solution ever. Now what? That doesn’t tell him what script was causing it.
Almost 50% of what I learned is from the dev hub. Its a very good resource to learn new things, I don’t understand how it is a trap.
it has to be the script because the warning only started showing up yesterday when I added a leaderboard and a time script, I deleted the leaderboard few hours ago but I still got the warnings
ALRIGHT, I figured the problem out! it was actually caused by this script and another script too, the badge script was where it gave player a badge when you were about 100 minutes in game but it seems that if any player on the leaderboard had 100 (or all players had 100 combined) it gave the badge for everyone, it wasn’t a Problem before I got the saving time leaderboard. people could easily get the badge just by joining as 90% of the players have more than 100 minutes… How did I not notice this earlier, so stupid
There are specific functions that only work when the player is in the current server. Look through any Roblox functions you’ve recently started using and check their documentation in the API reference if they require the user to be in the server.
Do you have a script that Awards someone a badge if they’ve reached a certain time amount? because that was it for me. IF you don’t have one then I recommend checking if u have any scripts with similar function.
Yes, there is a badge which awards if player plays for 10 mins and another for 1 hour
then that is the cause of it. i’m unsure how to fix it but removing the script helped for me
I fixed it, by adding a line if player ~= nil and game.Players:FindFirstChild(player.Name) ~= nil
in which part bro because still failed in my case
Not sure why you defined some things twice like that…
This seems to work fine like this so, hope this fixes your datastore.
local DataStoreService = game:GetService("DataStoreService")
local playerData = DataStoreService:GetDataStore("TotalTime")
local Players = game:GetService("Players")
local AlwaysTrue = true
local function savePlayerData(playerUserId, plr)
playerData:SetAsync(playerUserId, plr.leaderstats.Time.Value)
print("Everything is fine, data saved.")
end
local function saveOnExit(plr)
local playerUserId = "Player_" .. plr.UserId
savePlayerData(playerUserId, plr)
end
local function onPlayerAdded(plr)
local playerUserId = "Player_" .. plr.UserId
local leaderstats = Instance.new("Folder")
leaderstats.Name = 'leaderstats'
leaderstats.Parent = plr
local timee = Instance.new("IntValue")
timee.Parent = leaderstats
timee.Name = 'Time'
local playerUserId = "Player_" .. plr.UserId
local data = playerData:GetAsync(playerUserId)
timee.Value = data
repeat wait(5) --tested at 5
local newTime = timee.Value + 1
timee.Value = newTime
until AlwaysTrue == false
end
Players.PlayerRemoving:Connect(saveOnExit)
Players.PlayerAdded:Connect(onPlayerAdded)
Unless you can edit your datastore in studio you might want to run the line;
playerData:RemoveAsync(“Player_”… tostring(yourID) ) --or however you want to do this.
Just to make sure your data isn’t messed up to start with and saved that way.