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

Beam Color Sequence not working!?

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

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)

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