Inverting and reverting colors and lighting effects

so i have this script which does: if you touch it the colors on your camera become inverted.

what i want it to do is when i touch it a few sec afterwards the colors become normal. ive also made a bloom, depth of field and sky effect which i only want to be enabled when the colors are inverted.

explained short:
touch the brick, colors become inverted, the bloom, depth of field and sky effect become enabled. touch the brick again and colors become normal, bloom, depth of field and sky effect go away.

(with sky effect i mean the sky option in lighting which changes the sun size and texture)


script.Parent.Touched:Connect(function(Hit)
	local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
	if not Player then return end
	local Remotes = game:GetService("ReplicatedStorage"):FindFirstChild("Remotes")
	if not Remotes then return end
	local Other = Remotes:FindFirstChild("Other")
	if not Other then return end
	Other:InvokeClient(Player, "SetInvert", true)
end)

ehm whats the client script that is supposed to receives the event? and Whats the issue?

Just slap in a couroutine.wrap with a wait() inside and have it disappear after set amount of time?

Well, I also don’t know how to put in the Lighting effects (Bloom, Depth Of Field and sky)

On the topic of bloom, depth of field, and sky, some options are: you can create instances and insert them into the lighting via a localscript,or you can have them all pre-made and stored within lighting (but disabled) and they’d be enabled.

You can choose how you want the bloom, depth of field, and sky to look by inserting these into lighting within studio and experimenting with the properties! Then, have the client tween or change the values of the effects to these properties.

Personally, I would just pre-make all my lighting effects and just enable/disable them.

On the topic of inverting colors, this interesting community tutorial thread seems to share a very simple method of color inversion (to stack two ColorCorrectionEffects within lighting with -1 saturation)

1 Like

I pre-made all of the lighting effects and the current original post script works, all it does is if I touch it it becomes inverted, though I want it so that if I touch it again it’ll be reverted to normal colors. I also don’t know how to put this all in the script since this script was made by my friend and he currently is taking a break.

So to switch the lighting, the remote that is received by the client would have something like:


local lighting = game:GetService(“Lighting”)

local effect1 = lighting:WaitForChild(“Bloom”)


— remote received 
effect1.Enabled = not effect1.Enabled — true switches to false and vice versa 

What you can also do is create a loop:


for _,v in pairs(lighting:GetChildren()) do 
if ( check if it is a lighting effect, i.e bloom, color correction etc! you can use v:IsA(“class”) or do v.Name == “name” to check for the object class or name! ) then 
v.Enabled = not v.Enabled
end
end

Please excuse any mistakes as I typed this out on my phone.

1 Like

hmm, is the depth of field in here too? do i put this at the end of the script?

I’m assuming there may be already some type of remote function set up within a local script? Or does it only exist in the server script at the moment?