Script not running with no errors

Try looking up the screenshot shortcut for your computer.
If you’re on a Windows PC I can help you out.

it starts in the core script disabled, which inside the core script it clones the script then parents it to the player instance
Screenshot 2022-02-09 002413
then when the script is parented to the player instance, it is activated and does not work despite no errors
Screenshot 2022-02-09 002441

I actually don’t know what to say but, this can be the solution. Also parent it to ‘StarterCharacterScripts’

while true do
	if not script.Parent.Health.Value == 100 then
		print("regening")
		script.Parent.Health.Value = script.Parent.Health.Value + 1
		task.wait(0.5)
	end
	task.wait()
end

it works the same way as my script so it did not work as well

Parent it to StarterCharacterScripts and define the Humanoid.

I have figured it out. You were correct. The script seems to not work when it’s an instance within the player. My apologies.

but i thought that in the beginning, so what i did is put it in the character insatnce itstead but that still did not work, which instead it strangely just force deletes the script unless it errors

wait i believe its because it has to be in startercharacterscripts, am i correct?

I suggest not having a script clone at all. Try a system like this:

--Stored in a Script in ServerScriptService
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	local SubHealth = player:FindFirstChild("SubHealth") or player:WaitForChild("SubHealth")
	local regenerating = false
	SubHealth.Changed:Connect(function()
		if SubHealth.Value > 100 or SubHealth.Value < 0 then return end -- Might wanna change those comparison operators
		if regenerating then return end
		regenerating = true
		while SubHealth.Value <= 100 do
			SubHealth.Value = SubHealth.Value + 1
			task.wait(0.5)
		end
		regenerating = false
	end)
end)

I haven’t playtested this yet, so let me know if you have any issues. Also, if you have questions about how the code works, please ask.

yeah exactly but also not exactly instead what about in startercharacterscripts, because i dont cloning is causing the issue at all

that would mean starterscripts would never work because they always clone to the character, or my theory is that only local scripts work with the player instance

Script does not work in a Player instance.

just put it in character or put it in StarterPlayerScripts if you want it to only run once my man

script.Parent.Health:GetPropertyChangedSignal("Value"):Connect(function()
--code here
end)

i think i found a solution, it was because scripts dont work in player instances and the reason why scripts get deleted when i parent them to the player character is because they have to be in startercharacterscripts, so i fixed the problem, at least i think so

local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")

Humanoid.HealthChanged:Connect(function(NewHealth)
	--Do code when humanoid's health changes.
end)

It’s because you weren’t correctly referencing the humanoid instance (of which the “Health” property is a member of), you were referencing the character model instead.

The above script example would work as a local script/server script parented to the “StarterCharacterScripts” folder.