Turning off grass using local script

workspace.Terrain.Decoration = false

it says Decoration is not a valid member of terrain, I tried opening the workspace and setting it on and it works, why doesnt it work for a script

3 Likes

I don’t know why you need to use a script for this. Just go to terrain properties and disable decorations.

1 Like

uh, obviously for a graphic settings in game

8 Likes

It’s not possible as indicated by the API reference

NotScriptable
This member cannot be accessed by any Lua code. Attempts to do so will result in an error.
It may be possible to change its value from Roblox Studio’s property window.

4 Likes

The roblox client already have settings for the graphics anyways, it would be redundant to make separate graphical settings for the game.

3 Likes

Not sure why’d you’d need this–the new grass is better in performance than the old one.

1 Like

He’d need this if players have a low graphic computer like a potato one or something else that can’t handle high performance objects or else bad frame per seconds.

In this case, you can’t manually turn off the decoration in the terrain as a visitor that has no access to the place’s studio.

6 Likes

Roblox has graphics settings, though.

1 Like

It doesn’t get rid of the decoration grasses though, or does it?

2 Likes

You can try using terrain:ReplaceMaterial() from grass to leafygrass, which doesnt show the particles. You might want to use Terrain.MaxExtents to get the region3int16 from your whole terrain and then try converting it to region3, which can be found here, so you can use it as the region parameter of ReplaceMaterial.

Alternatively, you could use a Teleport function to teleport the player to one of 2 identical places, except that one has Terrain.Decoration = false and the other one is set to true.
Bad part is that it might make your game look less popular, because the player are split into more servers, so that might be one reason for someone to quit earlier. It might also be that you want to have decoration set to true but your friend dont want to, so you’ll have to choose with him which one you want.

But if you plan on making something like minecraft, where you have your own server to play and call your friends, it wont be a bad option at all. I did that on an unfinished project, one place has decoration off and Lighting.Technology=Voxels, while the other has decoration=true and Lighting.Technology=ShadowMap, like the following:
UnnamedGame

7 Likes

I know this is an old thread, but wanted to mark that this solution worked perfectly for me, although I had to manually calculate the extents of my terrain because Terrain.MaxExtents was giving me absurdly large numbers. I also change between grass and leafygrass. In my case I have a custom settings menu and players can toggle grass in that menu. Code snippet below:

local te = Region3.new(
		Vector3.new(-750, -5, -750),
		Vector3.new(750, 300, 750)
	)

function ToggleG()
customsettings.Grass.Value = not customsettings.Grass.Value
gui.Select:Play()
if customsettings.Grass.Value then
spanel.Grass.Button.ImageTransparency = 0
game.Workspace.Terrain:ReplaceMaterial(te,4,Enum.Material.LeafyGrass,Enum.Material.Grass)
else
spanel.Grass.Button.ImageTransparency = 1
game.Workspace.Terrain:ReplaceMaterial(te,4,Enum.Material.Grass,Enum.Material.LeafyGrass)
end
end spanel.Grass.Button.MouseButton1Click:Connect(ToggleG)
2 Likes

Just want to add to this thread. This solution does work, but only if you don’t change terrain on the server after that. So if you have mining or explosions - they will update the terrain, adding the grass back unfortunately.

So there is still no solution for me sadly