So when the game starts do this script
for i,v in pairs(game.Workspace:GetChildren())
if game.Players:FindFirstChild(v.Name)
if v:FindFirstChild(“Health”)
v:FindFirstChild(“Health”):Destroy()
end
end
end
So when the game starts do this script
for i,v in pairs(game.Workspace:GetChildren())
if game.Players:FindFirstChild(v.Name)
if v:FindFirstChild(“Health”)
v:FindFirstChild(“Health”):Destroy()
end
end
end
They aren’t too hard.
I’ll write a quick demo for you:
Requires a RemoteEvent “Event” in ReplicatedStorage.
LocalScript (the sender, in StarterPlayerScripts):
local event = game.ReplicatedStorage:WaitForChild("Event")
event:FireServer("Hello!")
Script (the receiver, in ServerScriptService):
local event = game.ReplicatedStorage:WaitForChild("Event")
event.OnServerEvent:Connect(function(player, message)
print(player.Name .. " said " .. message)
end)
Both scripts may be server scripts (im unsure)
Remote events arnt needed… all you need is a loop when the game starts to delete all heslth scripts like i juet said
I’m pretty confused can you send a screenshot of the folder?
Also it’s better to add a script in StarterCharacterScript so you can delete it with less code
But, as I just said earlier, a disabled script cannot run again.
That is why I am reccomending using RemoteEvents.
When the game starts if you run the loop it wont need disabling…
This is the post btw
It should work
In my opinion it’s better if you just modify the default Health script. Health manages Humanoid health regeneration so you can add a condition check to make sure that the player should be regenerating health and then it’d be as simple as toggling a checkbox to enable or disable regeneration.
Health (Script in StarterCharacterScripts):
-- Gradually regenerates the Humanoid's Health over time.
local REGEN_RATE = 1/100 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 1 -- Wait this long between each regeneration step.
local REGEN_ATTRIBUTE = "HealthRegenEnabled" -- Attribute name to use when managing health regen.
local REGEN_DEFAULT_STATE = true -- If the humanoid should regen health by default when spawning (true) or not (false).
--------------------------------------------------------------------------------
local Character = script.Parent
local Humanoid = Character:WaitForChild'Humanoid'
--------------------------------------------------------------------------------
Humanoid:SetAttribute(REGEN_ATTRIBUTE, REGEN_DEFAULT_STATE)
-- Quick and dirty way of triggering HealthChanged as each next iteration starts
-- after HealthChanged fires. Regeneration can stop midway but the script wouldn't
-- know to start it back up based purely off of the attribute. For advanced developers,
-- recommend racing a Promise between HealthChanged and attribute changed signal as
-- the condition to begin the next iteration in the while loop.
Humanoid:GetAttributeChangedSignal(REGEN_ATTRIBUTE):Connect(function ()
task.defer(function ()
Humanoid.Health -= 0.01
end)
Humanoid.Health += 0.01
end)
while true do
while Humanoid.Health < Humanoid.MaxHealth and Humanoid:GetAttribute(REGEN_ATTRIBUTE) == true do
local dt = wait(REGEN_STEP)
local dh = dt*REGEN_RATE*Humanoid.MaxHealth
Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth)
end
Humanoid.HealthChanged:Wait()
end
Toggling health regeneration for players is then just as simple as changing the attribute on their Humanoid instead of figuring out disabled scripts or placement or anything (this thread has become incredibly full of noise and strayed pretty far from the original topic):
-- Example of disabling health regeneration for everyone
for _, player in ipairs(game:GetService("Players"):GetPlayers()) do
-- Skip players without a character or humanoid
if not player.Character or not player.Character:FindFirstChild("Humanoid") then continue end
player.Character.Humanoid:SetAttribute("HealthRegenEnabled", false)
end
The health script and the mainscirpt are both server scripts therefore remote events are unneeded since it’s used for client-server communication
That made no sense.
Also, you should use the code block for your scripts (```), so it’s easier to see your script.
I don’t think the Health Script is loacted in StarterCharacterScripts since it’s added by roblox upon the insertion of the character
Or he may have added a custom health script himself before creating this topic
edit
He’s saying copy the Health script and put it in StarterCharacterScripts.
I did realize however he needs to disable the default roblox health script which is the problem (title of the topic)
That is not completely true.
As @colbert2677 said, you can simply just use an attribute to toggle the health regeneration (something I should’ve thought of earlier).
Missed that part sorry
30chaa
Guys here I want to put script disable:
Here is the SSS folder:
Here is the HealthRegenerationDisable Script:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Character)
local ScriptCheck = Character:FindFirstChild("Health")
if ScriptCheck and ScriptCheck:IsA("Script") then
ScriptCheck:Destroy()
end
end)
end)
Hope this helps…
Do you have any error in the output?
No I dont have any error in output
Does it work when you reset character?