When the player first enters the cobweb, you can simply grab their mass and slow them down using a couple tricks:
Firstly, you can slow down their walk speed, which will control horizontal speed.
For vertical speed, you can apply an upward force to their character as they are falling (similar to cobwebs in Minecraft). The best approach from what I have seen is to use a VectorForce. In this case, it should go on the HumanoidRootPart.
The VectorForce will apply a continuous force of specified scale to a given physics body. You can simply adjust the effect to get the desired speed you want the player to fall or slow down at when walking in the cobwebs:
The Module I used below is ZonePlus: ZonePlus v3.2.0 | Construct dynamic zones and effectively determine players and parts within their boundaries
local Zone = require(game:GetService("ReplicatedStorage"):WaitForChild("Zone"))
local Cobweb = Zone.new(workspace.Cobweb)
local playersInCobweb = {}
local COBWEB_GRAVITY = 0.35
local function getCharacterMass(character: Model): any
if character then
local mass
for _, part in pairs(character) do
if part:IsA("BasePart") then
mass += part:GetMass()
end
end
return mass
end
end
local function SlowdownPlayer(player: Player)
if player then
local character = player.Character
if character then
local HRP = character.HumanoidRootPart
if HRP then
local characterMass = getCharacterMass(character)
local vf = Instance.new("VectorForce")
vf.Parent = HRP
vf.Attachment0 = HRP.RootAttachment
vf.RelativeTo = Enum.ActuatorRelativeTo.World
vf.Force = Vector3.new(
0,
(characterMass * workspace.Gravity) * COBWEB_GRAVITY,
0
)
return vf
end
end
end
end
Cobweb.playerEntered:Connect(function(player)
if player then
local character = player.Character
if character then
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
humanoid.WalkSpeed = 10
playersInCobweb[player] = SlowdownPlayer(player)
end
end
end
end)
Cobweb.playerExited:Connect(function(player)
if player and playersInCobweb[player] then
local character = player.Character
if character then
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
humanoid.WalkSpeed = 16 -- Change to other, if desired
end
end
playersInCobweb[player]:Destroy()
end
end)