Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make this script into a script that heals you every 10 seconds?

Asked by 4 years ago

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.

2 answers

Log in to vote
0
Answered by
Geobloxia 251 Moderation Voter
4 years ago
Edited 4 years ago

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
0
Doesn't work for some reason, the script will be a effect for a equipable soul I don't exactly know how to do it. RedSoloYT 10 — 4y
0
Like a tool? Geobloxia 251 — 4y
0
Done. Geobloxia 251 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
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

0
thx RedSoloYT 10 — 4y
0
ur welcome mistercandle 0 — 4y

Answer this question