So I have snow terrain in my game and I'm trying to make the snow have "footprints" also called deformation. I have a script and it has a couple of errors.

local Players = game:GetService("Players")
local function onCharacterAdded(character)
	local humanoid = character:WaitForChild("Humanoid")
	local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
	local floorChangedSignal = humanoid:GetPropertyChangedSignal("FloorMaterial")

	floorChangedSignal:Connect(function()

		if humanoid.FloorMaterial == Enum.Material.Snow then

			local Ray = Ray.new(character.Head.CFrame.p, character.Head.CFrame.LookVector * Vector3.new(0,100,0))
			local ignoreList = {humanoid.Parent}
			local hit, hitposition = workspace:FindPartOnRayWithIgnoreList(Ray, ignoreList)
			if hit and hit:IsA("Terrain") then
				workspace.Terrain:FillBall(hitposition, 2, Enum.Material.Air)
			end
		end
	end)
			
			

2 comments

0

What exactly are the errors?

0

"Enum.Material.Air) end end end)" is underlined in red in the script editor and in output it says this "ServerScriptService.LavaDamage(ServerScriptService):18: Expected 'end' (to close 'function' at line 2), got ; did you forget to close 'then' at line 14?"