How would i make ice terrain slippery? I know you can do it with part friction, but is there a way for terrain ice?
why not just put invisible parts over the terrain/
you can make terrain slippery by changing the CustomPhysicalProperties just like a part, but it affects all terrain. I don’t think you can set the friction property of just ice terrain. You can use rays or invisible triggers to detect when a player is walking or driving on ice and then change the Terrain.CustomPhysicalProperties locally.
oh i am no where near skilled enough to script rays or whatever that is, thanks for letting me know though.
Ill see how that works out will it work if the part is can collide off?
Could i just use Enum.FloorMaterial? And when they step on ice it changes the workspace custom physical properties locally?
like this?
while wait() do
local floor = script.Parent.Parent:FindFirstChild("Humanoid")
if floor.FloorMaterial == Enum.Material.Ice or floor.FloorMaterial == Enum.Material.Glacier then
game.Workspace.Terrain.CustomPhysicalProperties.Density = 0.191
game.Workspace.Terrain.CustomPhysicalProperties.Friction = 0.004
game.Workspace.Terrain.CustomPhysicalProperties.Elasticity = 0.15
game.Workspace.Terrain.CustomPhysicalProperties.FrictionWeight = 100
elseif floor.FloorMaterial == Enum.Material.Grass or floor.FloorMaterial == Enum.Material.Sand or floor.FloorMaterial == Enum.Material.Ground or floor.FloorMaterial == Enum.Material.Cobblestone or floor.FloorMaterial == Enum.Material.Concrete or floor.FloorMaterial == Enum.Material.SmoothPlastic or floor.FloorMaterial == Enum.Material.Metal then
game.Workspace.Terrain.CustomPhysicalProperties.Density = 0.7
game.Workspace.Terrain.CustomPhysicalProperties.Friction = 0.3
game.Workspace.Terrain.CustomPhysicalProperties.Elasticity = 0.5
game.Workspace.Terrain.CustomPhysicalProperties.FrictionWeight = 1
end
end
or this
local floor = script.Parent.Parent:FindFirstChild("Humanoid")
if floor.FloorMaterial == Enum.Material.Ice or floor.FloorMaterial == Enum.Material.Glacier then
game.Workspace.Terrain.CustomPhysicalProperties.Density = 0.191
game.Workspace.Terrain.CustomPhysicalProperties.Friction = 0.004
game.Workspace.Terrain.CustomPhysicalProperties.Elasticity = 0.15
game.Workspace.Terrain.CustomPhysicalProperties.FrictionWeight = 100
elseif floor.FloorMaterial == Enum.Material.Grass or floor.FloorMaterial == Enum.Material.Sand or floor.FloorMaterial == Enum.Material.Ground or floor.FloorMaterial == Enum.Material.Cobblestone or floor.FloorMaterial == Enum.Material.Concrete or floor.FloorMaterial == Enum.Material.SmoothPlastic or floor.FloorMaterial == Enum.Material.Metal then
game.Workspace.Terrain.CustomPhysicalProperties.Density = 0.7
game.Workspace.Terrain.CustomPhysicalProperties.Friction = 0.3
game.Workspace.Terrain.CustomPhysicalProperties.Elasticity = 0.5
game.Workspace.Terrain.CustomPhysicalProperties.FrictionWeight = 1
end
end
This will get you started
Paste this into a LocalScript. Put the script in StarterCharacterScripts or StartPlayerScripts
local DefaultPhysicalProperties = PhysicalProperties.new ( 0.7, 0.3, 0.5, 1, 1 )
local SlipperyPhysicalProperties = PhysicalProperties.new ( 0.7, 0, 0.5, 100, 1 )
while wait(1) do
local ray = Ray.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position, Vector3.new(0,-5,0))
local objecthit, hitposition,normal,material = workspace:FindPartOnRay(ray, game.Players.LocalPlayer.Character, false, true)
print(objecthit, hitposition,normal,material)
if material == Enum.Material.Ice then
workspace.Terrain.CustomPhysicalProperties = SlipperyPhysicalProperties
else
workspace.Terrain.CustomPhysicalProperties = DefaultPhysicalProperties
end
end
Oh ok… thank you
30 characters