Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't my colorcorrectioneffect script working?

Asked by 8 years ago

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

Log in to vote
0
Answered by
rexbit 707 Moderation Voter
8 years ago

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")
0
i don't understand how this will fix it. please explain it more! HalfPinky456 12 — 8y
0
How much explantion do you need? WaitForChild works using strings. rexbit 707 — 8y
Ad

Answer this question