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

How can i fix my only team healing script because it does not work help?

Asked by 5 years ago

So i was experiment to make team only healing script, but turns out it didn't work. And it doesn't show any error, so i was wondering if i did anything wrong. (here's the code) while true do

for i, v in pairs(game.Teams["Vampire"]:GetPlayers()) do

local v = part.Parent:findFirstChild("Humanoid")

if v~=nil then

v.Health = v.Health + 2

end

wait(1)

end

0
Is this inside any event? Endergenius100 12 — 5y
0
no NungkiceNicekung 22 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

for 1, you are not looping it, the for only goes over every player once and 2, im not sure you can change v without it returning the original v later

local team = "Vampires"
local health = 2
local delay = 1
while true do
    for k,v in pairs(game.Players:GetPlayers()) do
        if v.Team = game.Teams[team] then
            local h = v.Character:FindFirstChildOfClass("Humanoid")
            if not h then
                return nil
            end
            h.Health = h.Health + health
        end
    end
    wait(delay)
end
0
didnt work tho NungkiceNicekung 22 — 5y
0
is this supposed to be local script or normal script? and i also try put it in the script service, but still dint work :( NungkiceNicekung 22 — 5y
0
server sided, ill test it right now because i made it in a hurry fanofpixels 718 — 5y
0
ok as soon as i pasted it in to roblox it turns out line 6 was supposed to use ==, not =. :P fanofpixels 718 — 5y
0
weird, no matter what i do it wont work, not even the quality marked health pad seems to work fanofpixels 718 — 5y
Ad

Answer this question