What I’m trying to do is to have a small part on a bottom of the vehicle that changes the terrain below
Basically just trying to make a lawnmower
But no matter which guide I follow or try to edit the code myself, but nothing has happened
This is what code looks like that I currently have
local WorkspaceService = game:GetService("Workspace")
local Mower = WorkspaceService.Mower
local Part1 = Mower.GrassCutter.Position
local Part2 = Mower.GrassCutter.Position
WorkspaceService.Terrain:ReplaceMaterial(Region3.new(Part1,Part2), 4, Enum.Material.Grass, Enum.Material.Ground)
And a screenshot of where the part 1 and 2 are located
(The green boxes)
I am wondering why this is not working at all and anyone knows and fix
You need to put the WorkspaceService.Terrain:ReplaceMaterial(Region3.new(Part1,Part2), 4, Enum.Material.Grass, Enum.Material.Ground) in a loop so it will run more than once. Right now, your script runs it at the beginning, and then it ends. You can use something like while true do, or you can get more complicated and utilize the RunService.
while true do
if Character.Humanoid.SeatPart then -- If player is sitting in a seat
print ("Player sitting")
WorkspaceService.Terrain:ReplaceMaterial(Region3.new(Part1,Part2), 4, Enum.Material.Grass, Enum.Material.Ground)
end
task.wait()
end
It’s not giving me any errors so I honestly don’t know what’s wrong with it