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

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

Asked by 10 years ago

I was thinking

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


any helpers?

2 answers

Log in to vote
-1
Answered by
Krlos21 45
10 years ago

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

0
I want it to change the colors at certain moments KennyAtkins 0 — 10y
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 Krlos21 45 — 10y
0
(or use the" :OnTouch " string when that part is touched) or use the wait() string and use a function as Krlos21 45 — 10y
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 Krlos21 45 — 10y
0
Why don't you put that code in your answer? Just edit your answer. Tkdriverx 514 — 10y
Ad
Log in to vote
-1
Answered by
Destrings 406 Moderation Voter
10 years ago

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

Answer this question