Ok, i think i understand what you are trying to do. And i will tell you where you went wrong. When declaring variables there are two types, Global and Local. Local variables can only be used when inside of a function. So that was the first Mistake. Secondly, if you have a space in the object declared in the variable, its slightly more complicated. it should look like this if you want a space
ball = game.Workspace.["Fifa Ball"]
It is much easier to use no spaces. The final product should turn out like this
function onClicked()
local brick = Instance.new("Part", game.Workspace)
brick.Name = "FifaBall"
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
You can put this script inside any part along wit ha ClickDetector for it to work. You can even take steps further and manipulate the location of the brick upon its spawning.
****Hope This helped you :D
2 comments
I tested it out, and I keep getting an error that it's "unable to find module asset id" in the output.
what is the script's parent. when i tried to do this script it worked fine for me. also try clearing output and look inside workspace to see if it is even spawning in