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

Am I changing this Beam Color correctly?

Asked by 4 years ago

It is not working for some reason? Please help if you can.

01if v:FindFirstChild("6") then
02    for _, v2 in pairs(v:GetChildren()) do
03 
04        if v2:FindFirstChild("BeamOne") then
05            v2.BeamOne.Color = ColorSequence.new(Color3.fromRGB(Data.SlashColor2.Value), Color3.fromRGB(Data.SlashColor2.Value))
06        end
07 
08        if v2:FindFirstChild("BeamTwo") then
09            v2.BeamTwo.Color = ColorSequence.new(Color3.fromRGB(Data.SlashColor3.Value), Color3.fromRGB(Data.SlashColor3.Value))
10        end
11 
12        if v2:FindFirstChild("BeamThree") then
13            v2.BeamThree.Color = ColorSequence.new(Color3.fromRGB(Data.SlashColor4.Value), Color3.fromRGB(Data.SlashColor4.Value))
14        end
15    end        
16end
0
Put prints all around the code and see/show what printed, are there any errors? We don't see what you see, v could not have 6 in it, v could not have any children, etc., you need to give us more info. imKirda 4491 — 4y

1 answer

Log in to vote
0
Answered by
TGazza 1336 Moderation Voter
4 years ago

try this:

01local v = script.Parent
02--// this Data table isnt needed since you have your own? its a way for me to debug the code
03local Data = {
04    SlashColor2 = {Value = Color3.fromRGB(0,255,255)},
05    SlashColor3 = {Value = Color3.fromRGB(255,0,255)} ,
06    SlashColor4 = {Value = Color3.fromRGB(255,168,64)}
07}
08if v:FindFirstChild("6") then
09    local Six = v["6"]
10    if Six:FindFirstChild("BeamOne") then
11        Six.BeamOne.Color = ColorSequence.new({
12            -- this would normally be something like
13            --[[
14                Key:                     (Time to show color, The color to show )
15                ColorSequenceKeypoint.new(0                 ,Color3.new(255,128,0),
View all 38 lines...

Hope this helps! :)

Ad

Answer this question