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

How to change color when instancing new "part" ?

Asked by
Bulvyte 388 Moderation Voter
8 years ago

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

Log in to vote
1
Answered by
neoG457 315 Moderation Voter
8 years ago
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.

0
How wouldn't it work ? :D thanks anyway! Bulvyte 388 — 8y
Ad
Log in to vote
1
Answered by 8 years ago

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!

0
Thanks for explaining it for me, I was kinda short on time. neoG457 315 — 8y

Answer this question