I have a LocalScript that’s supposed to change the color of the footstep dust ParticleEmitter coming from my character, based on the color of the ground I’m walking on. When I have my code running, this is the stuff I get.
while true do
wait()
local RootPart =script.Parent.HumanoidRootPart
local Ignore = script.Parent
local ray = Ray.new(RootPart.CFrame.p,Vector3.new(0,-50,0))
local Hit, Position, Normal, Material = workspace:FindPartOnRay(ray,Ignore)
if Hit then script.Parent.FootDust.Dust.Color = Hit.ColorSequence
end
end
If I use Color3 or BrickColor, it will say "ColorSequence expected, got BrickColor/Color3. This is really annoying and it grinds my gears. Please help immediately.
I’m not too familiar with the inner workings of ColorSequences due to the lack of documentation on them but you should be able to construct a new ColorSequence with the Color value of the part by setting the Color property to something like Dust.Color = ColorSequence.new(Hit.Color). Let me know if that works or not.
while true do
wait()
local RootPart =script.Parent.HumanoidRootPart
local Ignore = script.Parent
local ray = Ray.new(RootPart.CFrame.p,Vector3.new(0,-50,0))
local Hit, Position, Normal, Material = workspace:FindPartOnRay(ray,Ignore)
if Hit then script.Parent.FootDust.Color = Color3.new(Hit.Color)
end
end
I tried this. It doesn’t work, but no errors are thrown.
When I run this in the command bar, it SAYS it works, but nothing changes. Maybe the script must be a SCRIPT and not Local.
EDIT: aight bro it won’t work we gon’ need an expert out here
All colour values of ParticleEmitters are of the ColorSequence datatype. You are required to construct a new ColorSequence in order to set the colour of a particle emitter. See @metryy’s post.
What doesn’t work? What code are you working with right now? Have you tried debugging this to see what your values are coming back as to confirm if they’re intended or not?
You didn’t post the code you were working with and you were told several times how to make this work. You are also not providing information every time the script supposedly doesn’t work for you at all; no console errors, no updated code, nothing. You need to supply information at any point while working with others to resolve your problem.
The Color value of a ParticleEmitter only accepts a ColorSequence object. ColorSequence objects must be constructed in either three ways:
With a single Color3 value which serves as the start and end gradient colour
With two Color3 values that define the start and end colours of the gradient
With a table of ColorSequenceKeypoint objects that construct a gradient
Wrap the baseplate colour in a ColorSequence and assign it to the ParticleEmitter’s colour. If it doesn’t work and you reply as such, PLEASE PROVIDE INFORMATION SUCH AS YOUR UPDATED CODE.
while true do
wait()
local RootPart =script.Parent.HumanoidRootPart
local Ignore = script.Parent
local ray = Ray.new(RootPart.CFrame.p,Vector3.new(0,-50,0))
local Hit, Position, Normal, Material = workspace:FindPartOnRay(ray,Ignore)
if Hit then script.Parent.FootDust.Color = ColorSequence.new(Hit.BrickColor.Color)
end