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

Script doesn't spawn correct part?

Asked by 4 years ago

The script doesn't spawn the part correctly.

function generatePart(Color)
    local part = Instance.new("Part",game.Workspace)
    part.Anchored = false
    part.Transparency = 0.5
    part.BrickColor = BrickColor.new (Color)
    part.Parent = workspace
end
generatePart("Bright Green")
generatePart()
generatePart()
generatePart()

By the way, I haven't finished the other generate part but it doesn't spawn green part.

4 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

"Bright Green" is not a color. It is "Bright green" Check out colors here: https://developer.roblox.com/en-us/articles/BrickColor-Codes

function generatePart(Color)
    local part = Instance.new("Part",game.Workspace)
    part.Anchored = false
    part.Transparency = 0.5
    part.BrickColor = BrickColor.new (Color)
    part.Parent = workspace
end
generatePart("Bright green")
generatePart()
generatePart()
generatePart()
0
Ok thanks! TheKingOfDaMemes 24 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Maybe change it to Color3

function generatePart(Color)
    local part = Instance.new("Part",workspace)
    part.Anchored = false
    part.Transparency = 0.5
    part.Color = Color3.new(Color)
end
generatePart(255,0,0) -- Red
0
almost, it is black. TheKingOfDaMemes 24 — 4y
Log in to vote
0
Answered by
JesseSong 3916 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago
while true do
wait(1)
function generatePart(Color)
    local part = Instance.new("Part",game.Workspace)
    part.Anchored = false
    part.Transparency = 0.5
    part.BrickColor = BrickColor.new ( "Bright Green")
    part.Parent = workspace
end
end
generatePart()
Log in to vote
0
Answered by
Nckripted 580 Moderation Voter
4 years ago

You have to supply a parameter for every single one of the times you called the function, or else you will get an error.

Answer this question