All scripts stopped working after game overwrite

I am sorry if this is not scripting support, I just didn’t know what this bug would count towards. Yesterday night I assumed I saved my game correctly only to wake up today and see that there was an auto-save, so not wanting to lose the progress I had made, I overwrote it using the auto-saved game. Now when I test to see if all my data was saved I discovered that none of the scripts within the game even work. So I had reset the games version to yesterday but the issue still persists.

You can see this with the datastore I made (this is not the whole script only the part that creates folders in the player, this is only so data can be accessed locally without having to use a remote event), but even after waiting 5 minutes only the initial “DataFolder” is present in the player, seen below:

--Folder Setup --
		local DataFolder = plr:WaitForChild("DataFolder")
		local CustomCharData = Instance.new("Folder", DataFolder)
		CustomCharData.Name = "CustomCharData"
		
		--Instances --
		
		--Eyes
		local EyesData = Instance.new("Folder", CustomCharData)
		EyesData.Name = "EyesData"
		
		local eyeType = Instance.new("StringValue", EyesData)
		eyeType.Name = "EyeType"
		eyeType.Value = profile.Data.Eyes.EyeType
		local eyeColour = Instance.new("StringValue", EyesData)
		eyeColour.Name = "EyeColour"
		eyeColour.Value = profile.Data.Eyes.EyeColour
		local HC = Instance.new("BoolValue", EyesData)
		HC.Name = "HC"
		HC.Value = profile.Data.Eyes.Heterochromia
		local HC_Colour = Instance.new("StringValue", EyesData)
		HC_Colour.Name = "HC_Colour"
		HC_Colour.Value = profile.Data.Eyes.HC_Colour
		
		--Hair
		local HairData = Instance.new("Folder", CustomCharData)
		HairData.Name = "HairData"
		
		local Hair1 = Instance.new("StringValue", HairData)
		Hair1.Name = "Hair1"
		Hair1.Value = profile.Data.Hair.Hair1
		local Hair2 = Instance.new("StringValue", HairData)
		Hair2.Name = "Hair2"
		Hair2.Value = profile.Data.Hair.Hair2
		local Hair3 = Instance.new("StringValue", HairData)
		Hair3.Name = "Hair3"
		Hair3.Value = profile.Data.Hair.Hair3
		local hairColour = Instance.new("StringValue", HairData)
		hairColour.Name = "HairColour"
		hairColour.Value = profile.Data.Hair.HairColour
		
		--Clothes
		local ClothesData = Instance.new("Folder", CustomCharData)
		ClothesData.Name = "ClothesData"
		
		local ShirtId = Instance.new("StringValue", ClothesData)
		ShirtId.Name = "ShirtId"
		ShirtId.Value = profile.Data.Clothes.ShirtId
		local PantsId = Instance.new("StringValue", ClothesData)
		PantsId.Name = "PantsId"
		PantsId.Value = profile.Data.Clothes.PantsId
		
		--Accessories
		local AccessoriesData = Instance.new("Folder", CustomCharData)
		AccessoriesData.Name = "AccessoriesData"
		
		local HeadAcc = Instance.new("StringValue", AccessoriesData)
		HeadAcc.Name = "HeadAcc"
		HeadAcc.Value = profile.Data.Accessories.Head
		local BodyAcc = Instance.new("StringValue", AccessoriesData)
		BodyAcc.Name = "BodyAcc"
		BodyAcc.Value = profile.Data.Accessories.Body
		local BackAcc = Instance.new("StringValue", AccessoriesData)
		BackAcc.Name = "BackAcc"
		BackAcc.Value = profile.Data.Accessories.Back
		
		--Others
		local charCreated = Instance.new("BoolValue", CustomCharData)
		charCreated.Name = "CharCreated"
		local EarType = Instance.new("StringValue", CustomCharData)
		EarType.Name = "EarType"
		EarType.Value = profile.Data.EarType
		local MouthType = Instance.new("StringValue", CustomCharData)
		MouthType.Name = "MouthType"
		MouthType.Value = profile.Data.MouthType
		local Skin = Instance.new("StringValue", CustomCharData)
		Skin.Name = "SkinColour"
		Skin.Value = profile.Data.SkinColour
		local Height = Instance.new("StringValue", CustomCharData)
		Height.Name = "Height"
		Height.Value = profile.Data.Height
		local NameValue = Instance.new("StringValue", CustomCharData)
		NameValue.Name = "Name"
		NameValue.Value = profile.Data.Name

Maybe I’ve missed a similar post in the forum but from what I can see, I am the only one who has experienced this. If more evidence is needed I believe I have a video of buttons within the game working in my character customizer. I even have a picture of a Finished character.

Does it seem like no scripts are running whatsoever? Try putting some print()s at the start, or at multiple points in a few of your scripts to verify this.

I don’t believe the scripts are not running entirely, just that after a few lines they stop running.

i believe you can use breakpoints to debug this, or just use the print statements

I have tried both print statements and breakpoints but it’s like they are being ignored entirely.

copy and paste into a new place?

Can you track at which line they stop? Put prints between each line at the start of the script and see how far it comes.
After that you can paste the line(s) after the last print that runs.

this hasn’t worked either, maybe it does have something to do with my scripts but I cant think of any reason as to why they would all suddenly stop working

It seems like the functions in the scripts do not work including connected functions, anything outside of these functions work normally.

are you sure your scripts are enabled? do they have the correct run context?

Can you show us one of the full scripts that don’t work as intended?

this is the entire datastore (I am using a profile store module), the “PlayerAdded” function does not actually run, stopping the data itself from loading. I can also show another, such as the button module I made for character customization tomorrow when I wake up.

local Players = game:GetService("Players")
local RS = game:GetService("RunService")
local ServerScript = game:GetService("ServerScriptService")
local RepStorage = game:GetService("ReplicatedStorage")

local profileStore = require(ServerScript["Library/Helpers"].ProfileStore)

local Template = require(ServerScript.Main.Data.CCData.Data)
local DataManager = require(ServerScript.Main.Data.CCData.CC_DataManager)
print("Test")
local function PlayerAdded(plr : Player)
	
	task.wait(1)
	
	local playerGui = plr.PlayerGui
	local SlotScreen = playerGui:WaitForChild("MenuGui").SlotSelect
	local slotNum = SlotScreen.SlotGui.Buttons["Left+Right"].CurrentSlot
	local confirm = SlotScreen.SlotGui.Buttons["Left+Right"].CurrentSlot.SlotConfirm

	repeat task.wait(.1) until confirm.Value == true

	--Access ProfileStore
	local DataStore = profileStore.New("Slot"..tostring(slotNum.Value).."CustomCharData", Template)
	print("Test")
	local function Init(plr : Player, profile : typeof(DataStore:StartSessionAsync()))
		print("Test")
		--Folder Setup --
		local DataFolder = plr:WaitForChild("DataFolder")
		local CustomCharData = Instance.new("Folder", DataFolder)
		CustomCharData.Name = "CustomCharData"
		
		--Instances --
		
		--Eyes
		local EyesData = Instance.new("Folder", CustomCharData)
		EyesData.Name = "EyesData"
		
		local eyeType = Instance.new("StringValue", EyesData)
		eyeType.Name = "EyeType"
		eyeType.Value = profile.Data.Eyes.EyeType
		local eyeColour = Instance.new("StringValue", EyesData)
		eyeColour.Name = "EyeColour"
		eyeColour.Value = profile.Data.Eyes.EyeColour
		local HC = Instance.new("BoolValue", EyesData)
		HC.Name = "HC"
		HC.Value = profile.Data.Eyes.Heterochromia
		local HC_Colour = Instance.new("StringValue", EyesData)
		HC_Colour.Name = "HC_Colour"
		HC_Colour.Value = profile.Data.Eyes.HC_Colour
		
		--Hair
		local HairData = Instance.new("Folder", CustomCharData)
		HairData.Name = "HairData"
		
		local Hair1 = Instance.new("StringValue", HairData)
		Hair1.Name = "Hair1"
		Hair1.Value = profile.Data.Hair.Hair1
		local Hair2 = Instance.new("StringValue", HairData)
		Hair2.Name = "Hair2"
		Hair2.Value = profile.Data.Hair.Hair2
		local Hair3 = Instance.new("StringValue", HairData)
		Hair3.Name = "Hair3"
		Hair3.Value = profile.Data.Hair.Hair3
		local hairColour = Instance.new("StringValue", HairData)
		hairColour.Name = "HairColour"
		hairColour.Value = profile.Data.Hair.HairColour
		
		--Clothes
		local ClothesData = Instance.new("Folder", CustomCharData)
		ClothesData.Name = "ClothesData"
		
		local ShirtId = Instance.new("StringValue", ClothesData)
		ShirtId.Name = "ShirtId"
		ShirtId.Value = profile.Data.Clothes.ShirtId
		local PantsId = Instance.new("StringValue", ClothesData)
		PantsId.Name = "PantsId"
		PantsId.Value = profile.Data.Clothes.PantsId
		
		--Accessories
		local AccessoriesData = Instance.new("Folder", CustomCharData)
		AccessoriesData.Name = "AccessoriesData"
		
		local HeadAcc = Instance.new("StringValue", AccessoriesData)
		HeadAcc.Name = "HeadAcc"
		HeadAcc.Value = profile.Data.Accessories.Head
		local BodyAcc = Instance.new("StringValue", AccessoriesData)
		BodyAcc.Name = "BodyAcc"
		BodyAcc.Value = profile.Data.Accessories.Body
		local BackAcc = Instance.new("StringValue", AccessoriesData)
		BackAcc.Name = "BackAcc"
		BackAcc.Value = profile.Data.Accessories.Back
		
		--Others
		local charCreated = Instance.new("BoolValue", CustomCharData)
		charCreated.Name = "CharCreated"
		local EarType = Instance.new("StringValue", CustomCharData)
		EarType.Name = "EarType"
		EarType.Value = profile.Data.EarType
		local MouthType = Instance.new("StringValue", CustomCharData)
		MouthType.Name = "MouthType"
		MouthType.Value = profile.Data.MouthType
		local Skin = Instance.new("StringValue", CustomCharData)
		Skin.Name = "SkinColour"
		Skin.Value = profile.Data.SkinColour
		local Height = Instance.new("StringValue", CustomCharData)
		Height.Name = "Height"
		Height.Value = profile.Data.Height
		local NameValue = Instance.new("StringValue", CustomCharData)
		NameValue.Name = "Name"
		NameValue.Value = profile.Data.Name
		
	end
	
	local profile = DataStore:StartSessionAsync("Uma_" .. plr.UserId, {
		Cancel = function()
			return plr.Parent ~= Players
		end
	})
	print("Test")
	if profile ~= nil then
		profile:AddUserId(plr.UserId)
		profile:Reconcile() --Edits Table if something new is added
		
		--Session Logging
		profile.OnSessionEnd:Connect(function()
			DataManager.Store[plr] = nil
			plr:Kick()
		end)
		print("Test")
		if plr.Parent == Players then
			DataManager.Store[plr] = profile
			print("Test")
			Init(plr, profile)
		else
			profile:EndSession()
		end
		
	else
		plr:Kick("There was an error loading Data")
	end
	
end
print("Test")
Players.PlayerAdded:Connect(PlayerAdded)

for _, plr in Players:GetPlayers() do
	task.spawn(PlayerAdded, plr)
end
print("Test")
Players.PlayerRemoving:Connect(function(plr)
	local profile = DataManager.Store[plr]
	
	if not profile then return end 
	
	profile:EndSession()
	DataManager.Store[plr] = nil
end)

Your functions are running. They’re yielding, and there’s no print early enough to show you that.

Look at where the first print("Test") inside PlayerAdded actually sits — it comes after this line:

repeat task.wait(.1) until confirm.Value == true

There is no print between entering the function and that loop. So “nothing prints” doesn’t mean the function never ran, it means execution never got past that point. Everything downstream — the ProfileStore session call, Init, the whole CustomCharData tree — sits behind it. That also explains why DataFolder is the only thing you see: Init doesn’t create DataFolder, it waits for one that something else made.

confirm resolves to SlotSelect.SlotGui.Buttons["Left+Right"].CurrentSlot.SlotConfirm. If that BoolValue never becomes true, the loop spins forever and never throws. A yield gives you silence; a broken script gives you a red line in Output. You’re describing silence, which fits a stuck loop much better than “the scripts stopped working”.

Add three prints and you’ll know inside a minute:

local function PlayerAdded(plr: Player)
	print("entered", plr)
	task.wait(1)
	local playerGui = plr.PlayerGui
	local SlotScreen = playerGui:WaitForChild("MenuGui").SlotSelect
	local slotNum = SlotScreen.SlotGui.Buttons["Left+Right"].CurrentSlot
	local confirm = slotNum.SlotConfirm
	print("waiting on SlotConfirm, currently", confirm.Value)
	repeat task.wait(.1) until confirm.Value == true
	print("confirm passed")

If you get “entered” and “waiting on SlotConfirm” but never “confirm passed”, the data script is fine and the real bug is in whatever is supposed to set SlotConfirm — which is exactly the sort of thing an overwrite would have reverted.

Two things worth fixing either way.

The GUI chain is only partly guarded. playerGui:WaitForChild("MenuGui").SlotSelect waits for MenuGui and then assumes SlotSelect, SlotGui, Buttons, Left+Right and CurrentSlot are all there already. On a live server that line can error instead of yielding, so you would get a different failure in production than in Studio. Wait for the deepest node you actually need, not the first one.

And swap the poll for an event:

while not confirm.Value do
	confirm.Changed:Wait()
end

Same behaviour, no ten-times-a-second poll per player, and it makes the yield obvious to whoever reads it next.

1 Like

I apologise for any confusion, it seems like I had mixed up my events and that broke everything as the event fired to change “confirm.Value” to true was overwritten for creating the character as they had similar names. To avoid anything like this again I’m going to change how I organise and name my events.

Thank you for your help