I need to make a thing where players around my player are slowed down if they’re too close
My script doesn’t slow down the other players and I cant find what’s wrong with it…
game.ReplicatedStorage.Sand.SAV.OnServerEvent:Connect(function(Player)
local x = Instance.new("Part")
x.Shape = Enum.PartType.Ball
x.Parent = game.Workspace
x.Size = Vector3.new(200,200,200)
x.CanCollide = false
x.Anchored = true
x.Position = Player.Character.HumanoidRootPart.Position
x.Touched:Connect(function(hit)
if hit.Parent.Name ~= Player.Name then
local WS = hit.Parent.Humanoid.WalkSpeed
hit.Parent.Humanoid.WalkSpeed = 2
wait(1)
hit.Parent.Humanoid.WalkSpeed = WS
end
end)
wait(0.1)
x:Remove()
end)
I also need it to slow down players that aren’t moving.