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

What am I doing wrong with changing the Beam's colour?

Asked by
Nep_Ryker 131
6 years ago

I am trying to change the effect Beam's colour in a script. But it's giving me an error and I don't know what is wrong or what is causing it to give me an error.

Here is the script:

local Zombie = workspace:WaitForChild("Zombie")
local ZombieHealth = Zombie:WaitForChild("Humanoid")
local UpperTorso = Zombie:WaitForChild("UpperTorso")
local DamageEffect = Instance.new("Beam")
local Attachment0 = Instance.new("Attachment")
local Attachment1 = Instance.new("Attachment")

Attachment0.Parent = workspace.Model.AI.Head
Attachment1.Parent = workspace.Zombie.Head
DamageEffect.Parent = workspace.Model.AI.Head
DamageEffect.Attachment0 = Attachment0
DamageEffect.Attachment1 = Attachment1
DamageEffect.LightEmission = 1
DamageEffect.Width0 = 1.5
DamageEffect.Color = Color3.new(0,0,255)      --What is wrong here?

Also, the error was bad argument #3 to 'Color' (ColorSequence expected, got Color3)

1 answer

Log in to vote
2
Answered by 6 years ago

The beam's colour property needs a ColourSequence

You can easily construct one with one colour by doing this:

beam.Color = ColorSequence.new(Color3.new(0,0,1))

You should also note that Colour3 values are numbers between 0 and 1.

0
Thanks! Nep_Ryker 131 — 6y
Ad

Answer this question