This is the script I made but I don't think it works that easily.
local lplr = game.Players.LocalPlayer lplr.Humanoid.Health + 10 wait(20) repeat
Please help me if you know how do I solve this problem.
Okay you did not use the repeat function(you don't need it in this case) correctly and you did not do you heal function correctly either. That's ok. That's why you asked!
This might work:
local plr = game.Players.LocalPlayer while true do plr.Humanoid.Health = plr.Humanoid.Health + 10 wait(20) -- Amount of time to wait between healing end
Here is my new, more efficient method for gear/tool 1: Create tool in StarterPack 2: Create part in Workspace 3: Name part "Handle" with correct capitals and spelling 4: Put part in tool 5: Create script in tool 6: Put code inside script:
local tool = script.Parent local handle = tool:WaitForChild("Handle") local holding = false local num = 2 local hl = 20 tool.Equipped:Connect(function() holding = true end) tool.Unequipped:Connect(function() holding = false end) while wait(num) do if holding then local plr = tool.Parent plr.Humanoid.Health = plr.Humanoid.Health + hl end end
local plr = game.Players.LocalPlayer local num = 20 --Change this to the amount of time between turns local hl = 10 --How much health you regen each time while true do plr.Humanoid.Health = plr.Humanoid.Health + hl wait(num) end
Somebody kinda beat me to it but this is the same function just easier for you to make changes to just use while true do to repeat the repeat function will repeat until something changes