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

What's wrong with this script???

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
function onTouch()
    local Robux = Instance.new("Part")
    Robux.Name = "Robuck"
    Robux.BrickColor = BrickColor.new("Bright green")
    Robux.Size = Vector3.new(1, 0.4, 2)
    Robux.TopSurface = "Smooth"
    Robux.BottomSurface = "Smooth"
    Robux.Position = game.Workspace.SpawnPart.Position
end
game.Workspace.Button.Touched:connect(onTouch)
0
spawn a new brick LegoDude9630 15 — 9y
0
What is "SpawnPart"? Is it the same size as the new Part you are intending to create? Chili1924 150 — 9y
0
Well, BrickColor = BrickColor.new won't work, try Robux.BrickColor = Color3.new(0,0,255) and erase 'local' Grenaderade 525 — 9y
0
The BrickColor.new("Bright green") is completely vaild. Erasing local will not help in this situation. What will help is any information on what happens and if there is any output. User#2 0 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago
function onTouch()
    Robux = Instance.new("Part")
    Robux.Name = "Robuck"
    Robux.BrickColor = BrickColor.new(0,0,255)
    Robux.Size = Vector3.new(1, 0.4, 2)
    Robux.TopSurface = "Smooth"
    Robux.BottomSurface = "Smooth"
    Robux.CFrame = game.Workspace.SpawnPart.CFrame
end
game.Workspace.Button.Touched:connect(onTouch)
Ad
Log in to vote
0
Answered by 9 years ago

You have to say where to spawn it,

Like this:

function onTouch()
    local Robux = Instance.new("Part")
    Robux.Name = "Robuck"
    Robuck.Parent=game.Workspace
    Robux.BrickColor = BrickColor.new("Bright green")
    Robux.Size = Vector3.new(1, 0.4, 2)
    Robux.TopSurface = "Smooth"
    Robux.BottomSurface = "Smooth"
    Robux.Position = game.Workspace.SpawnPart.Position
end
game.Workspace.Button.Touched:connect(onTouch)

For line 08 you CAN do

Robuck.Position=Parent.SpawnPart.Position

I THINK that should solve you problem.

Answer this question