generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How do you target a block of terrain?

Previous Thread :: Next Thread 
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
29 May 2015 04:40 PM
I know terrain:Clear() but..

Also how do you get the terrain type?

"You don't want to be their cool. Be a good person by a respectable figures point; you." ~ TheNewChicken.
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
29 May 2015 04:54 PM
b

"You don't want to be their cool. Be a good person by a respectable figures point; you." ~ TheNewChicken.
Report Abuse
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
29 May 2015 05:20 PM
You get a "block" or now a cell of terrain by using

Terrain:WorldToCellPreferSolid(Vector3) or Terrain:WorldTOCellPreferEmpty(Vector3)

This returns a vector3 value of where the closest cell is located to that position.
Then to get the terrain type of that cell, you do Terrain:GetCell(int x, int y, int z)

I haven't figured out how to get the other things that it returns, but I figured this out:
local Cell = Terrain:GetCell(x,y,z)
print(Cell) --> Prints the Enum value of the material(Enum.Material.Grass, ect)
Report Abuse
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
29 May 2015 05:20 PM
All of that is here
http://wiki.roblox.com/index.php?title=API:Class/Terrain
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
29 May 2015 05:21 PM
Also:

http://wiki.roblox.com/index.php?title=API:Class/TerrainRegion
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
29 May 2015 05:24 PM
Can you say local block = blah

block:Destroy()

"You don't want to be their cool. Be a good person by a respectable figures point; you." ~ TheNewChicken.
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
29 May 2015 05:26 PM
I think you can just do :SetCell and set the cell type to nil.
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
29 May 2015 05:30 PM
no worky

script.Parent.Equipped:connect(function(Mouse)
Mouse.Icon = "rbxasset://textures\\GunCursor.png"
Mouse.Button1Down:connect(function()
game:GetService("Terrain"):WorldToCellPreferSolid(Mouse.Hit.p):SetCell(nil)
end)
end)

script.Parent.Unequipped:connect(function(Mouse)
Mouse.Icon = ""
end)

"You don't want to be their cool. Be a good person by a respectable figures point; you." ~ TheNewChicken.
Report Abuse
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
29 May 2015 05:31 PM
That is :SetCell(x,y,z, Enum.Material.Empty, Enum.CellBlock.Solid, Enum.CellOrientation.X)

or :SetCells(Region3int16, Enum.Material.Empty, Enum.CellBlock.Solid, Enum.CellOrientation.X)

CellBlock and CellOrientation can be anything that fits your needs.
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
29 May 2015 05:34 PM
Wont work

script.Parent.Equipped:connect(function(Mouse)
Mouse.Icon = "rbxasset://textures\\GunCursor.png"
Mouse.Button1Down:connect(function()
game:GetService("Terrain"):SetCell(Mouse.Hit.p,Enum.Material.Empty,Enum.CellBlock.Solid,Enum.CellOrientation.X)
end)
end)

script.Parent.Unequipped:connect(function(Mouse)
Mouse.Icon = ""
end)

"You don't want to be their cool. Be a good person by a respectable figures point; you." ~ TheNewChicken.
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
29 May 2015 05:44 PM
script.Parent.Equipped:connect(function(Mouse)
Mouse.Icon = "rbxasset://textures\\GunCursor.png"
Mouse.Button1Down:connect(function()
game:GetService("Terrain"):WorldToCellPreferSolid(Mouse.Hit.p):SetCell(Mouse.Hit.p,Enum.Material.Empty,Enum.CellBlock.Solid,Enum.CellOrientation.X)
end)
end)

script.Parent.Unequipped:connect(function(Mouse)
Mouse.Icon = ""
end)

"You don't want to be their cool. Be a good person by a respectable figures point; you." ~ TheNewChicken.
Report Abuse
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
29 May 2015 06:01 PM
local Terrain = game.Workspace:WaitForChild("Terrain")

script.Parent.Equipped:connect(function(mouse)
mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function()
local Cell = Terrain:WorldToCellPreferSolid(Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z))
Terrain:SetCell(Cell.x, Cell.y, Cell.z, Enum.CellMaterial.Empty ,Enum.CellBlock.Solid,Enum.CellOrientation.X)
end)
end)

script.Parent.Unequipped:connect(function(Mouse)
Mouse.Icon = ""
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image