Script disable problem

In my game reset character is disabled bc it is a story game

If you want I can add you in studio so you can see what’s the problem if you want

No thanks i am not on my developement account right now.
You should try this because i believe it doesn’t work because the character spawns before the CharacterAdded Function connects:

local Players = game:GetService("Players") 

Players.PlayerAdded:Connect(function(player) 
	local function charAdded(Character)
		if Character then
			local ScriptCheck = Character:FindFirstChild("Health")

			if ScriptCheck and ScriptCheck:IsA("Script") then 
				ScriptCheck:Destroy() 
			end 
		end
	end
	
	charAdded(player.Character)
	
	player.CharacterAdded:Connect(charAdded) 
end)

Then what I write in MainScript to disable Health script

Oh you want disable it from main script? Give me a moment

yes lol, mainscript is in sss btw

Add a modulescript named HealthRegenDisabler under MainScript


I gotta go sorry :sad:

:((((((((((((((((((((( nooooooooooooooo

I’m back i had to do something sorry

I can’t understand what your trying to do, but to completely disable the health regen script, you can make an empty script in StarterCharacterScripts, which will stop roblox from inserting the health regen. Otherwise, if you want to enable it, maybe you can destroy() the roblox health regen script, then clone it back to the character to enable it.

I put script in startercharacterscripts then when game started I wait(10) HealthScript:Destroy() but it didn’t work so yeah…

If you want to re-enable, don’t put an empty script in startercharacterscripts as that will completely disable it.

Maybe you can first destroy the player’s script, then when you need it back, just clone it back (you will need a copy of the script somewhere)

If you’re trying to temporarily disable a script, use this line:

callYourScriptName.Disabled = true

Not too sure what you’re tryna do though since I read the people below your post…

if you want to disable the heal just disable it from your main script and not a separate script?

for i, v in pairs(game.Players:GetChildren()) do
	local Character = v.Character or v.ChildAdded:Wait()
	Character:WaitForChild("Health"):Destroy()
end
2 Likes

Then I don’t need health script in SSS?

Roblox injects the Health script into StarterCharacterScripts at runtime. Inserting similarly named scripts to services where Roblox injects scripts will override the engine’s copy with your own. The same goes for forking PlayerModule, components of the Lua Chat System and so on.

1 Like

yeah you don’t remove it from that you just remove the health script from the main script

1 Like