I wrote a script to place a block:
local rs = game.ReplicatedStorage
local event = rs.GrassPlace
local current = workspace.CurrentBlock
local TemplateFolder = game.ServerStorage.TemplateBlocks
local blockValue = game.ServerStorage:FindFirstChild(current.Value)
current.Value = "Brick"
function place(plr,target,blocktype)
if current then
local blockInFolder = TemplateFolder[blockValue.Value]
if blockInFolder then
local newBlock = TemplateFolder[blockValue.Value]:Clone()
end
newBlock.Parent = workspace.Blocks
newBlock.Size = Vector3.new(4,4,4)
newBlock.Anchored = true
newBlock.Name = current.Value
newBlock.CFrame = CFrame.new(target.Position) + Vector3.new(0,4,0)
newBlock.Parent = workspace
end
end
event.OnServerEvent:Connect(place)
It says newBlock isn't defined, what is wrong??

3 comments
Umm it didn't work, I added a new part of the script to my question.
My bad, check my answer again.
It errors on line 11. " Workspace.BlockPlacement:11: attempt to index upvalue 'blockValue' (a nil value)"