Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Removing FillBlock() not working. What is the proper way to remove terrain with a script?

Hello! So I am trying to remove this piece of water (terrain) when a player uses a click detector, but when I click, it gives me this message: "attempt to index upvalue 'water' (a nil value)" I tought that it works like an Instance.new, but I am probably wrong, well, here's the code:

local water = game.Workspace.Terrain:FillBlock(game.Workspace.WaterPart.CFrame, game.Workspace.WaterPart.Size, Enum.Material.Water)

script.Parent.ClickDetector.MouseClick:Connect(function()
water:Destroy()
end)

Thank you.

1 answer

I fixed it. I forgot that you were able to fill areas with Enum.Material.Air.

This discussion is preserved as it was. New answers, comments, and votes are closed.