(Solved By YXFrosty) Infection system

This should do the trick:

local Infected = game.Workspace.Infected
local DefaultWait = 0.4

local function GoInfected(BodyColor) --Infected function
	BodyColor.HeadColor = BrickColor.new("Lime green")
	wait(DefaultWait)
	BodyColor.LeftArmColor = BrickColor.new("Lime green")
	wait(DefaultWait)
	BodyColor.RightArmColor = BrickColor.new("Lime green")
	wait(DefaultWait)
	BodyColor.LeftLegColor = BrickColor.new("Lime green")
	wait(DefaultWait)
	BodyColor.RightLegColor = BrickColor.new("Lime green")
	wait(DefaultWait)
	BodyColor.TorsoColor = BrickColor.new("Lime green")
end

--Get infected People
while true do
	for v, child in pairs(Infected:GetChildren()) do
		--Get infected Part
		for _, part in ipairs(child:GetDescendants()) do
			--Infected Script
			if part:IsA("BasePart") and part.CanTouch == true then
				part.Touched:Connect(function(hit)
					print("Touched")
					local Zombie = hit.Parent

					if Zombie.Parent == Infected then
						print("Already Infected")
					else
						if Zombie:FindFirstChild("Humanoid") then
							wait(0.8)
							local BodyColors = Zombie:FindFirstChild("Body Colors")

							GoInfected(BodyColors)
							Zombie.Parent = Infected
						end
					end
				end)
			end
		end
	end
	wait(1)
end
1 Like

ITs slowly print touched after i became zombie
But when i touch the Npc (the dummy test)
It print Like hell

Can you send me a screenshot or a video. Iā€™m getting really tired trying to figure this out. Hehe :slight_smile:

Edit: It prints like that because itā€™s a touch event. So you canā€™t stop it

Edit again: But does it work?

1 Like

Screenshot of what the output the test or anything ?
Edit: Its work perfectly
IT turn the test dummy into zombie and green

I found out how to make it print slowly
i make the while wait(1) do
so it will print slower but if player touch other too much it will still the Same

Anyways Thanks for helping YOu deserve the Solution and this cake :cake:

Maybe use heartbeat for performanceā€¦

I know I just remembered it when I saw your post on another topic, but too late.

1 Like

Credits to XYFrosty Thank you so much