So, I got a server script under a rig, and I want the rig to generate health. As a beginner scripter, the solution might be easy but it’s been on my nerves, so any help is well appreciated! Here is the server script:
local healthregn = 10
local wait = 4
local humanoid = rig:WaitForChild(“Humanoid”)
local rig = script.Parent
function regen()
if humanoid then
rig.Humanoid.Health = rig.Humanoid.Health + healthregn
end
local healthregn = 10
local wait = 4
local rig = script.Parent
local humanoid = rig:WaitForChild("Humanoid")
function regen()
if humanoid then
print(rig.Humanoid.Health)
rig.Humanoid.Health += healthregn
end
end
while true do
task.wait(wait)
regen()
end
Lets start with some basic debugging, what does this print?
If the sword is using a LocalScript to deal damage, this script might not work.
Yes do check the sword script I had a very similar issue when the rig would die, their ghost would literally haunt me (my weapons would only kill on the client)