What could be causing this crash?

This can be Human error which can be made from your scripts. Because you mentioned you haven’t tried the game properly other than on studio, these issues may be occurring now which you didn’t intend to happen or the malicious scripts have been put into your game by the plugins. However, looking from those Plugins, those developers seem recognised enough not to have anything bad inside of those plugins.
Check your scripts for loops

1 Like

Do you have any code running in replicatedfirst or in playerscripts that may loop indefinitely or wait for a child indefinitely?

Enable client scripts one at a time until you find the one causing the issue.

1 Like

None loop indefinitely, I’m very careful about that.

There is a few that may be using WaitForChild() indefinitely but they usually just throw a warning to the output rather that have a complete meltdown.

Strange that the backpack isn’t loading as well, so check any scripts that have something to do with that.

1 Like

Okay, after many disabling I’ve been lead to this localscript, which causes a complete crash SOMETIMES :roll_eyes: .
The only thing which may be causing the error is something to do with the remote event/function. Apart from that I can’t understand why this script in particular is having a hissy fit.

Code
local lval, xval = game.ReplicatedStorage.LevelXpChanged2:InvokeServer()

local levelGui = script.Parent.LevelFrame
local xpAdd = levelGui.XPAlert
local maxXP = 10
local currentLevel = 1
local currentXP = 0
local tempAdding = 0
local check = 0

local function xpAlert(val)
	spawn(function()
		if xpAdd.Visible == false then
			local rand = math.random(-1000,1000)
			check = rand
			tempAdding = val
			xpAdd.Position = UDim2.new(0,-10,1,0)
			xpAdd.TextTransparency = 0
			xpAdd.TextStrokeTransparency = 0.5
			xpAdd.Text = "+ " .. tostring(tempAdding) .. " XP"
			xpAdd.Visible = true
			xpAdd:TweenPosition(UDim2.new(0,-10,.25,0),Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .5)
			wait(2)
			if check == rand then
				for i = 0,1,0.05 do
					if check ~= rand then break end
					xpAdd.TextTransparency = i
					xpAdd.TextStrokeTransparency = 0.5 + i/2
					wait()
				end
				xpAdd.Visible = false
			end
		else
			local rand = math.random(-1000,1000)
			check = rand
			tempAdding = tempAdding + val
			xpAdd.Text = "+ " .. tostring(tempAdding) .. " XP"
			wait(2)
			if check == rand then
				for i = 0,1,0.05 do
					if check ~= rand then break end
					xpAdd.TextTransparency = i
					xpAdd.TextStrokeTransparency = 0.5 + i/2
					wait()
				end
				tempAdding = 0
				xpAdd.Visible = false
			end
		end
	end)
end

local function updateAll(values)
	local l = values[1]
	local x = values[2]
	
	local diff = 0
	
	if currentLevel == l then
		diff = x - currentXP
	else
		while true do
			diff = diff + ((20 + ((currentLevel*currentLevel)*2)))
			currentLevel = currentLevel + 1
			if currentLevel == l then 
				diff = diff - currentXP + x
				break
			end
		end
	end
	
	currentLevel = l
	currentXP = x
	
	levelGui.LevelLabel.Text = "Level " .. tostring(l)
	maxXP = 20 + ((l*l)*2)
	
	if x then
		xpAlert(diff)
	end

	levelGui.XPLabel.Text = "- " .. tostring(x) .. "/" .. tostring(maxXP)
	levelGui.BackXP.FrontXP:TweenSize(UDim2.new(math.min(1,x/maxXP),0,1,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine,.5)
end

updateAll({lval, xval})

game.ReplicatedStorage.LevelXpChanged.OnClientEvent:Connect(function(values)
	updateAll(values)
end)

EDIT: There is a while loop in the code, but it’s never been a problem before so why would it affect everything now?

What is the code responding to game.ReplicatedStorage.LevelXpChanged2?

1 Like

Ah, I think the issue may have been found?

So when a new player joined, if level.Value was 0 or level was nil, the script would return 0 to the client.

The while true loop then loops through until a value is equal to that number by adding 1, of course it never gets there.
This is why it was broken for some users and not others! Argh.

1 Like

Thanks everyone for helping me track down this issue.

The reason why I’d never discovered it before was because I already had saved data for my account, and thus this bug did not occur. Thank for everyone! Sorry for making such a rookie mistake 6 years into Roblox :joy:

2 Likes