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

I am wonder how to change the colors of a point light?

I was thinking

while true do
script.Parent.Color = (255, 255, 255) -- and like 2 more
end


any helpers?

2 answers

Do you want it to change with an script or how ? because if I am not wrong you can always set the PointLight object in a part and change the color using the properties options and change it to any color you want and add shadows to it Hope it helped

5 comments

0

I want it to change the colors at certain moments

0

In that case you might need the use of LocalScript in the part and use the CFrame option and the loop "if pressed" loop to make it change when it's touched (or

0

(or use the" :OnTouch " string when that part is touched) or use the wait() string and use a function as

0

local = game.workspace.part-- I think its how it starts and then use the if player haspressed "part"-- name of the part - then wait ()-- amount of time in seconds function= Color3.new() --choose the color and paste the properties inside the parenthesis remember for every "50" in properties you turn them to ".20 in the script and separate them by "", "", "" dont forget to add "end" when finished

0

Why don't you put that code in your answer? Just edit your answer.

Datatypes are not matching, that why you get an error. First (255, 255, 255) is not a valid Lua literal. While with native Lua datatypes most of the time you don't have to pay attention to the datatype because Lua is dynamic typed and can convert between datatypes implicitly. For example

a = 2
b = "2"
print(a+b)

If you run that code, you will get 4.

Variable a is holding an integer datatype, while variable b is holding a string. In a static typed language like C you would get an error unless you first explicitly convert b to a integer, but Lua does that implicitly (however in some cases where the interpreter is not smart enough, you will need to use tostring or tonumber).

But that doesn't happen with most Roblox datatypes. So your code should be

while true do
script.Parent.Color = Color3.new(1, 1, 1)
end

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