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

How can i change a color tint in RGB ?

Asked by 5 years ago
Edited 5 years ago

Hello, i wanted to make a tint color go red after a amount of time I added a color correction to camera and added this in there :

wait (27)
script.Parent.TintColor = ("255, 255, 255")

But it didn't work so i tried a local script :

local
wait (27)
script.Parent.TintColor = ("255, 255, 255")
end

But none of them changes the tint.

Also here is the adrees of the Script :

Camera ColorCorrection Script/LocalScript

3 answers

Log in to vote
1
Answered by
Zafirua 1348 Badge of Merit Moderation Voter
5 years ago
Edited 5 years ago

Couple things wrong with your code.

First and foremost, having a local on top of your script does not make your script local script. Please consider learning the difference between local script and server script. Also, please do not forget to learn about what exactly local is and why we use them.

You are also assigning the color values incorrectly. When specifying the color for any object, you are required to use the color3 table. For sake of readability, we use color3.fromRGB().

This function requires 3 arguments, all of them are integers.

We only have end when we are finished using a new scope we created. In this case, you are using it as a way to end the script. This is incorrect. We do not have end in the bottom of the script if you have not declared any scope whatsoever.

Please learn what exactly scope is to understand this.

Thus, your final script should be similar to, but not entitled to:

wait(27);
script.Parent.TintColor =  Color3.fromRGB(255, 0, 0); -- Bright Red Colour (255, 0, 0)

Also, consider declaring a variable for the TintColor.

0
Double space? "Color = Color3.fromRGB" It still works but I'm guessing it's a typo or I'm dumb and it's actually necessary. EmK530 143 — 5y
0
didn't worked Cioss_Team 14 — 5y
Ad
Log in to vote
0
Answered by
EmK530 143
5 years ago
Edited 5 years ago

First of all, you're making a string instead of a number.

(EDIT) I've searched and TintColor is part of a ColorCorrection effect. Changing TintColor was also strange as choosing the RGB choice of 1, 1, 1 gave you 255, 255, 255. But now the answer is correct.

local R = 255 -- change this to whatever you want
local G = 255 -- change this to whatever you want
local B = 255 -- change this to whatever you want
wait(27)
script.Parent.TintColor = Color3.new(R / 255, G / 255, B / 255)
Log in to vote
0
Answered by 5 years ago

first of all, just putting a line

local

with nothing else on the line doesn't make sense and doesn't do anything. And you should know 255,255,255 is white (a.k.a. the default color correction) instead of red. And there's no class called Color, it's Color3. Your code should be:

wait(27)
script.Parent.TintColor = Color3.new(1,0,0) -- Roblox uses OpenGL, and OpenGL uses a range of 0 to 1 for colors.

But for people who wanna do it an other way here's:

wait(27)
script.Parent.TintColor = Color3.fromRGB(255,0,0)

You're new to scripting aren't ya ;)

0
1st, i know it's the default color and, 2ndly a lil bit, i only know how to change any object's properties with a delay or after something happens and 3rdly, it didn't worked, tried local script and script. Cioss_Team 14 — 5y
0
have you waited 27 seconds? and did you get an error? BeAHacker666 75 — 5y

Answer this question