Ahhh I get it now. I’ll make sure to check for that.
Checked every FireServer
and OnServerEvent
. Nothing leads to datastores or anything to do with data.
How exactly does a player equip a title
If you mean literally, then just from the backpack like classic Roblox.
Update + Bump. Found out that this happens only when the server reaches about ~20 players. Checking the output, not a single player is nowhere near the 4MB limit. So, I have no idea whats going on.
try to print every parameter passed to :SetAsync()
or any function that’s supposed to save (i dont use profileservice)
I don’t think that’ll really help
Bump + update, I don’t think it’s a DDoS, I think it might be on my end. But how would I fix this still?
Hey, it definitely seems like a DDoS attack (going by when a player joins the game starts to freeze). There can be all sorts of issues related to the server crashing. From what I know, does this happen when profile service errors and soon crashes? There could be an issue relying on your game’s data handling code that could cause a high spike and then crash. I would point to DDoS attacks but as you have said, there aren’t any remote events connected to datastore. Just in case, can you send how you secure a remote? I want to know if the remote doesn’t have an underlying problem.
The situation we got right now is: because we have a system that saves levels, time and cash everytime their value changes, occasionally it tends to output the 105 error. The cause of the ping spike itself we don’t know yet.
So this is not player made, this is something with the datastore itself for sure.
I don’t want to directly blame it on the players, it could just be an issue with securing a remote (if something does affect the data store) or when the data store fails an infinite loop occurs causing the server to crash. Right now, it is difficult to really help as there is no direct answer on how to fix this. Can you send how you secure your remote events or how your data store works? This can help to try to see if there is any underlying issue with your code.
The remotes don’t have anything to do even close with datastores.
However, this is how the ProfileService is implemented
local DSS = game:GetService("DataStoreService")
local CNPFramework = DSS:GetDataStore("hidden")
local ProfileService = require(script:FindFirstChild("ProfileService"))
local ProfileTemplate = {
Level = 0,
Time = 0,
Bucks = 100,
Items = {},
Titles = {
Owned = {},
Equipped = "",
},
TitleColors = {
Owned = {},
Equipped = ""
},
Transfered = false,
}
local ProfileStore = ProfileService.GetProfileStore(
"hidden",
ProfileTemplate
)
local Profiles = {}
local function loadedProfile(plr, profile)
local Data = nil
if not profile.Data.Transfered then
Data = CNPFramework:GetAsync(plr.UserId)
end
local lstats = plr:FindFirstChild("leaderstats")
local lvl = lstats:FindFirstChild("Level")
local Time = lstats:FindFirstChild("Time")
local bucks = lstats:FindFirstChild("Bucks")
local titlesf = plr:WaitForChild("Titles")
local colorsf = plr:WaitForChild("TitleColors")
if type(Data) ~= "table" then
Data = nil
end
warn(profile.Data.Transfered)
if Data and not profile.Data.Transfered then -- Data.Transfer ~= true
warn("saved old data")
lvl.Value = Data.Level
Time.Value = Data.Time
bucks.Value = Data.Bucks
profile.Data.Level = Data.Level
profile.Data.Time = Data.Time
profile.Data.Bucks = Data.Bucks
profile.Data.Transfered = true
else
warn("transfered data")
lvl.Value = profile.Data.Level
Time.Value = profile.Data.Time
bucks.Value = profile.Data.Bucks
local transfer = Instance.new("BoolValue")
transfer.Name = "Transfered"
transfer.Parent = plr
if profile.Data.Titles then
titlesf.ChildAdded:Connect(function(child)
if child:IsA("BoolValue") then
if not table.find(profile.Data.Titles.Owned, child.Name) then
table.insert(profile.Data.Titles.Owned, child.Name)
end
child.Changed:Connect(function(value)
if value then
profile.Data.Titles.Equipped = child.Name
local char = plr.Character or plr.CharacterAdded:Wait()
if char then
local overhead = char:WaitForChild("Head"):WaitForChild("Overhead"):WaitForChild("Container")
local title = overhead:WaitForChild("Title")
if title then
title.Text = child.Name
end
end
end
end)
end
end)
colorsf.ChildAdded:Connect(function(child)
if child:IsA("BoolValue") then
if not hasTitleColor(profile, child.Name) then
table.insert(profile.Data.TitleColors.Owned, {child.Name, child:GetAttribute("RGB"):ToHex()})
end
child.Changed:Connect(function(value)
if value then
profile.Data.TitleColors.Equipped = child.Name
local char = plr.Character or plr.CharacterAdded:Wait()
if char then
local overhead = char:WaitForChild("Head"):WaitForChild("Overhead"):WaitForChild("Container")
local title = overhead:WaitForChild("Title")
if title then
title.TextColor3 = child:GetAttribute("RGB")
end
end
end
end)
end
end)
for _, title in pairs(profile.Data.Titles.Owned) do
local newTitle = Instance.new("BoolValue")
newTitle.Name = title
newTitle.Parent = titlesf
end
if titlesf:FindFirstChild(profile.Data.Titles.Equipped) then
titlesf:FindFirstChild(profile.Data.Titles.Equipped).Value = true
end
for _, data in pairs(profile.Data.TitleColors.Owned) do
local newTitle = Instance.new("BoolValue")
local rgb = hexToRGB(data[2])
local newRgb = Color3.fromRGB(rgb.R * 255, rgb.G * 255, rgb.B * 255)
newTitle.Name = data[1]
newTitle:SetAttribute("RGB", newRgb)
newTitle.Parent = colorsf
end
if colorsf:FindFirstChild(profile.Data.TitleColors.Equipped) then
colorsf:FindFirstChild(profile.Data.TitleColors.Equipped).Value = true
end
end
local items = game:GetService("ReplicatedStorage"):WaitForChild("Items")
for _, item in pairs(profile.Data.Items) do
local toolModel = items:FindFirstChild(item) or findNoCase(items:GetChildren(), item)
if toolModel then
local tool = toolModel:FindFirstChildWhichIsA("Tool")
local tool1 = tool:Clone()
local tool2 = tool:Clone()
tool1.Parent = plr:WaitForChild("Backpack")
tool2.Parent = plr:WaitForChild("StarterGear")
local load1, load2
tool1.Equipped:Connect(function()
local hasIdle = tool1:FindFirstChild("Idle", true)
if hasIdle then
load1 = plr.Character:FindFirstChild("Humanoid").Animator:LoadAnimation(hasIdle)
load1.Looped = true
load1:Play()
end
end)
tool1.Unequipped:Connect(function()
if load1 then
load1:Stop()
end
end)
--
tool2.Equipped:Connect(function()
local hasIdle = tool1:FindFirstChild("Idle", true)
if hasIdle then
load2 = plr.Character:FindFirstChild("Humanoid").Animator:LoadAnimation(hasIdle)
load2.Looped = true
load2:Play()
end
end)
tool2.Unequipped:Connect(function()
if load2 then
load2:Stop()
end
end)
end
end
end
--[[
lvl.Changed:Connect(function(val)
profile.Data.Level = val
end)
Time.Changed:Connect(function(val)
profile.Data.Time = val
end)
bucks.Changed:Connect(function(val)
profile.Data.Bucks = val
end)]]
end
local function intProfileService(player)
local profile = ProfileStore:LoadProfileAsync("Player_" .. player.UserId)
if profile ~= nil then
profile:AddUserId(player.UserId)
profile:Reconcile()
profile:ListenToRelease(function()
Profiles[player] = nil
player:Kick("Something went wrong. Please rejoin.")
end)
if player:IsDescendantOf(game:GetService("Players")) == true then
Profiles[player] = profile
loadedProfile(player, profile)
else
profile:Release()
end
else
player:Kick("Something went wrong. Please rejoin.")
end
end
game:GetService("Players").PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder", plr)
leaderstats.Name = 'leaderstats'
local lvl = Instance.new("IntValue", leaderstats)
lvl.Name = "Level"
lvl.Value = 0
local Time = Instance.new("IntValue", leaderstats)
Time.Name = 'Time'
Time.Value = 0
local Bucks = Instance.new("IntValue", leaderstats)
Bucks.Name = 'Bucks'
Bucks.Value = 100
local titles = Instance.new("Folder")
titles.Name = 'Titles'
titles.Parent = plr
local titles = Instance.new("Folder")
titles.Name = 'TitleColors'
titles.Parent = plr
coroutine.wrap(function()
while wait(30) do
Bucks.Value += math.round(3 * bucksIncrement)
end
end)()
coroutine.wrap(function()
while wait(60) do
Time.Value += 1
end
end)()
coroutine.wrap(function()
while true do
wait(math.random(30, 40))
if MPS:UserOwnsGamePassAsync(plr.UserId, 198830525) then
lvl.Value += 2
else
lvl.Value += 1
end
end
end)()
intProfileService(plr)
end)
game:GetService("Players").PlayerRemoving:Connect(function(Player)
local profile = Profiles[Player]
local leaderstats = Player:FindFirstChild("leaderstats")
local levels = leaderstats:FindFirstChild("Level")
local Time = leaderstats:FindFirstChild("Time")
local bucks = leaderstats:FindFirstChild("Bucks")
profile.Data.Level = levels.Value
profile.Data.Time = Time.Value
profile.Data.Bucks = bucks.Value
if profile ~= nil then
profile:Release()
end
end)
game:BindToClose(function()
for i, Player in pairs(game:GetService("Players"):GetPlayers()) do
local profile = Profiles[Player]
if profile ~= nil then
profile:Release()
end
end
end)
Hope that helps.
ANOTHER Update today: it is something with the ProfileService saving or/and loading. I just didn’t have time to analyze today closely. If anyone’s got any idea what could be causing the issue, let me know!
Hey, I looked through the code you sent above and I don’t see any issues in terms of causing the crashes but just optimizations. Have you tried saving and loading the data w/o profile service? As you said, it could be a problem with the profile service.
Previously, before I was hired, the game had a different scripter. And the datastore was really basic and people tended to lose their data often. When I added ProfileService, everything was working perfectly before the titles update. So I have a slight feeling, it may be something to so with the Titles or TitleColors
Solved it myself! I don’t really know how, but if I do remember to post a fix then I will, but for now I’m finally done.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.