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

Why isn't my colorcorrectioneffect script working?

I am trying to make it so that if you stand on a certain colored block, your screen gets tinted that color. So far, nothing I have tried is working. Please help!

player = game.Players.LocalPlayer
green = game.Workspace.Sections:WaitForChild(game.Workspace.Sections.Green)
blue = game.Workspace.Sections:WaitForChild(game.Workspace.Sections.Blue)
yellow = game.Workspace.Sections:WaitForChild(game.Workspace.Sections.Yellow)
red = game.Workspace.Sections:WaitForChild(game.Workspace.Sections.Red)
local cCorrect = Instance.new("ColorCorrectionEffect", game.Lighting)

red.Touched:connect(function(hit)
	if hit.Parent.Name ~= player.Name then return end
	cCorrect.TintColor = Color3.new(255/255, 183/255, 184/255)
end)

green.Touched:connect(function(hit)
	if hit.Parent.Name ~= player.Name then return end
	cCorrect.TintColor = Color3.new(162/255, 255/255, 147/255)
end)

yellow.Touched:connect(function(hit)
	if hit.Parent.Name ~= player.Name then return end
	cCorrect.TintColor = Color3.new(254/255, 255/255, 171/255)
end)

blue.Touched:connect(function(hit)
	if hit.Parent.Name ~= player.Name then return end
	cCorrect.TintColor = Color3.new(148/255, 148/255, 255/255)
end)

It is a local script with this format: game > Workspace > Sections > LocalScript

1 answer

✓ Accepted answer

Easy answer,WaitForChild works for strings.

player = game.Players.LocalPlayer
green = game.Workspace.Sections:WaitForChild("Green")
blue = game.Workspace.Sections:WaitForChild("Blue")
yellow = game.Workspace.Sections:WaitForChild("Yellow")
red = game.Workspace.Sections:WaitForChild("Red")

2 comments

0

i don't understand how this will fix it. please explain it more!

0

How much explantion do you need? WaitForChild works using strings.

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