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

How to change color when instancing new "part" ?

i got this rpg smoke script i want to change the smoke's color but i can't lol or else the rocket i fire breaks, but if i remove the line then it's good How can i change the smoke ball's color ?

function smoke(size, ahe)
	p = Instance.new("Part")
	p = BrickColor.Color3.new "Really black"
	p.Anchored = true
	p.CanCollide = false
	p.TopSurface = 0
	p.BottomSurface = 0
	m = 1
	p.CFrame = CFrame.new(script.Parent.Position + (script.Parent.CFrame.lookVector * ahe) + Vector3.new(math.random(-m,m),math.random(-m,m),math.random(-m,m)))
	p.Shape = "Ball"
	p.Size = Vector3.new(size,size,size)
	smo = script.SmokeScript:clone()
	smo.Parent = p
	p.Parent = game.Workspace
end

i tried this various ways, no success...

2 answers

✓ Accepted answer
function smoke(size, ahe)
    p = Instance.new("Part")
    p.BrickColor = BrickColor.new ("Really black")
    p.Anchored = true
    p.CanCollide = false
    p.TopSurface = 0
    p.BottomSurface = 0
    m = 1
    p.CFrame = CFrame.new(script.Parent.Position + (script.Parent.CFrame.lookVector * ahe) + Vector3.new(math.random(-m,m),math.random(-m,m),math.random(-m,m)))
    p.Shape = "Ball"
    p.Size = Vector3.new(size,size,size)
    smo = script.SmokeScript:clone()
    smo.Parent = p
    p.Parent = game.Workspace
end

Instead of Saying p = BrickColor.Color3.new "Really black" (Which is completely wrong.), use: p.BrickColor = BrickColor.new ("Really black")

Sorry if it doesnt work.

1 comment

0

How wouldn't it work ? :D thanks anyway!

Color3.new is only used for Smoke/Pointlight/Fire and more!

So when we take your script:

function smoke(size, ahe)
    p = Instance.new("Part")
    p = BrickColor = BrickColor.new("Really black") --- Like that 
    p.Anchored = true
    p.CanCollide = false
    p.TopSurface = 0
    p.BottomSurface = 0
    m = 1
    p.CFrame = CFrame.new(script.Parent.Position + (script.Parent.CFrame.lookVector * ahe) + Vector3.new(math.random(-m,m),math.random(-m,m),math.random(-m,m)))
    p.Shape = "Ball"
    p.Size = Vector3.new(size,size,size)
    smo = script.SmokeScript:clone()
    smo.Parent = p
    p.Parent = game.Workspace
end

Hope i helped!

1 comment

0

Thanks for explaining it for me, I was kinda short on time.

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