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

Beam Color Sequence not working!?

Asked by 2 years ago

Heres the code that controls the beam's color and every tower has a configuration folder with a color3value that determines the beam's color. But the color's always black.

local function fireBullet(tower, target) local bullet = game.Workspace.Bullets.partone:Clone()
bullet.Position = tower.Head.Position bullet.Parent = workspace.Camera bullet.CanCollide = false bullet.Anchored = true bullet.CanQuery = false

local towerColor = tower.Config.Trail.Value

bullet.ParticleEmitter.Color = ColorSequence.new(Color3.fromRGB(towerColor),Color3.fromRGB(towerColor))
bullet.Beam.Color = ColorSequence.new(Color3.fromRGB(towerColor),Color3.fromRGB(towerColor))

bullet.CFrame = CFrame.lookAt(bullet.Position, target.HumanoidRootPart.Position)

local projectileTween = TweenService:Create(bullet, TweenInfo.new(.35), {Position = target.HumanoidRootPart.Position})
projectileTween:Play()
Debris:AddItem(bullet, .35)

end

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

the script is attempting to look for RGB and is being returned a Color3 value. Color3 returns values from 0,1 and RGB returns from 0,255. you won't get the color from that.

local function toRGB(color3)
    if typeof(color3) ~= "Color3" then return end
    return math.round(color3.R*255),math.round(color3.G*255),math.round(color3.B*255)
end
local towerColor = toRGB(tower.Config.Trail.Value)
Ad

Answer this question