Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

0

Is this inside any event?

0

no

1 answer

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

5 comments

0

didnt work tho

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 :(

0

server sided, ill test it right now because i made it in a hurry

0

ok as soon as i pasted it in to roblox it turns out line 6 was supposed to use ==, not =. :P

0

weird, no matter what i do it wont work, not even the quality marked health pad seems to work

This discussion is preserved as it was. New answers, comments, and votes are closed.