Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can anyone help me with my script for snow becoming deeper when you step on it? (footprints)

Asked by
ht518 4
3 years ago
Edited 3 years ago

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)


0
What exactly are the errors? EiOooAxea 70 — 3y
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 <eof>; did you forget to close 'then' at line 14?" ht518 4 — 3y

Answer this question