I think the issue is terrain:ReplaceMaterial
I have rewritten it several times, but running the script will always end up crashing the game. I am attempting to get a region of terrain replaced with a different material when clicking the button
local open = true --GFX VARIABLES-- local Bloom = game.Lighting.Bloom local Blur = game.Lighting.Blur local SunRays = game.Lighting.SunRays local Shadows = game.Lighting.GlobalShadows --GFX VARIABLES-- --GRASS POSITION SETTINGS-- local min = game.Workspace.Part1 local max = game.Workspace.Part2 local Region = Region3.new(min.Position, max.Position) local materialToReplace = Enum.Material.Grass local replacementMaterial = Enum.Material.LeafyGrass --GRASS POSITION SETTINGS-- script.Parent.MouseButton1Click:Connect(function() if open == true then Bloom.Enabled = false Blur.Enabled = false SunRays.Enabled = false Shadows = false Region = Region:ExpandToGrid(4) workspace.Terrain:ReplaceMaterial(Region, 4, materialToReplace, replacementMaterial) open = false script.Parent.Text = "Fast GFX [Active]" else Bloom.Enabled = true Blur.Enabled = true SunRays.Enabled = true Shadows = true Region = Region:ExpandToGrid(4) workspace.Terrain:ReplaceMaterial(Region, 4, materialToReplace, replacementMaterial) open = true script.Parent.Text = "Fast GFX [InActive]" end end)
i figured it out i guess for some reason having the region already divisible by 4 crashes the game if you try to use Region:ExpandToGrid(4)