How do I change color correction when you touch a block?

I am new to scripting and I really want to do this anyway how can I touch and in what script would this go to? The block or some script service Idk?

2 Likes

Do you want to make a block change color on touch?

1 Like

Wait! I meant color correction not the block changing color!

Make a Script under the part you wish to execute the script on. I’ve created a simple script that can change the color of a block but you can change the second line to your own code. You’d want to use the .Touched event.

script.Parent.Touched:Connect(function()
script.Parent.BrickColor = BrickColor.new("Black")
end)

Can you be more specific as to what you wish to change?

I’d recommend looking at these:

https://developer.roblox.com/en-us/api-reference/class/TweenService

https://developer.roblox.com/en-us/api-reference/event/BasePart/Touched

Basically, TweenService smoothly changes certain properties

It can be really useful when you want to make smooth transitions, such as this:

TweenServiceExampleOne

And the Touched event will fire whenever the Part gets touched:

ezgif-2905870300

Well I mean as if it was the skybox but I am not sure how to change that and if I cant I resorted to using color correction which gives a hue idk how to explain it further from there.

To create this effect, you could change multiple attributes of the Part such as the Transparency, Color, Reflectance, Material, Size, etc?

Okay so maybe the skybox is the right way because I need the player to touch this block then a function or something like that changes the area skybox when you touch it and when you get out it should revert back into normal. I saw this in a game and I want to replicate it.

Oh, now I understand what you mean. Would you like it to change for the whole server or just the player who touches the part?

Just the player because other players may be in a different place :wink: :

Alright. So, firstly create a Sky under Lighting if you haven’t done so already and ensure it’s named “Sky”. Next, insert a LocalScript under the part with the following code, make sure to insert your textureIDs where it says to do so.

local sky = game.Lighting:WaitForChild("Sky")
script.Parent.Touched:Connect(function()
sky.SkyboxBk = "TEXTUREID HERE"
sky.SkyboxDn = "TEXTUREID HERE"
sky.SkyboxFt = "TEXTUREID HERE"
sky.SkyboxLf = "TEXTUREID HERE"
sky.SkyboxRt = "TEXTUREID HERE"
sky.SkyboxUp = "TEXTUREID HERE"
end)

If this doesn’t work, I’m quite unsure how to achieve what you wish to achieve.

local colorCorrection = Instance.new("ColorCorrectionEffect")
colorCorrection.Parent = game.Lighting

local touchPart = workspace.**YOUR PART NAME HERE**

touchPart.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") == false then return end
	colorCorrection.TintColor = Color3.fromRGB(255, 0, 0)
end)

This will turn the screen red when a player touches the touchPart.

Do I do this once again but touch ended to turn it back?

You would do

touchPart.TouchEnded:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") == false then return end
	colorCorrection.TintColor = Color3.fromRGB(255, 255, 255)
end)

It kinda flashes but I really need to learn script so I dont just take scripts