Made a very simple toggleable Print function

I was tired of having to go back and delete all my prints and then realize i need to put them back and it was really annoting, so i made this:

local ShouldPrint = true

--Simple Print Handler
local function PrintVal(Type, Text)
	if ShouldPrint == true then
		if Type == "Warn" then
			warn(Text)
		elseif Type == "Print" then
			print(Text)
		end
	end
end

Its a very easy to use and toggleable printhandler, just give it 2 parameters
Exaple:

local ShouldPrint = true --Should prints activate?

--Simple Print Handler
local function PrintVal(Type, Text)
	if ShouldPrint == true then
		if Type == "Warn" then
			warn(Text)
		elseif Type == "Print" then
			print(Text)
		end
	end
end


script.Parent.Touched:connect(function(part)
	if part.name == "EVIL Part" then
		PrintVal("Warn", "EVVVILLL!!!!!")
	elseif part.name == "Nice Part" then
		PrintVal("Print", "Aww!")
	end
end)

Thats all, this is my first time makin sum for anyone to use, but if yall wanna use it thats alright with me!

3 Likes

W release gonna use in my future projects trust

gotham needs you bro :sob:
Also thanks for usin this dumb little thing i made

1 Like

I would just use logpoints and toggle them on and off

i would personally make modulescript in replicatedstorage and bool value under that modulescript which decides if printing is enabled or not

then just local print=require(path.to.module) in every each script so it looks actually cleaner and you can disable printing globally in every each script without having to modify every each script in the game