#Scripts break after reset

2 messages · Page 1 of 1 (latest)

supple tinsel
#

That's it that's the title

I'm enabling them from my main menu script after it gets destroyed with this:

local scriptsFolder = game.Players.LocalPlayer.Character:WaitForChild("Scripts")
local scripts = scriptsFolder:GetChildren()
-- Few lines down...
for i, v in pairs(scripts) do
            if v:IsA("LocalScript") then
                v.Enabled = true
            end
        end

And then the scripts break. I tried making a separate enabler script with this:

local SCRIPTS = script.Parent.Scripts:GetChildren()

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
repeat task.wait() until character:FindFirstChild("Humanoid")
local humanoid = character:WaitForChild("Humanoid")

player.CharacterAdded:Connect(function()
    for i, v in pairs(SCRIPTS) do
        if v:IsA("LocalScript") then
            v.Enabled = true
        end
    end
end)

But this didn't work either. No idea how to fix this. If it helps, the explorer is attached to this post

supple tinsel
#

thank you very helpful